1

Am creating frontend custom page it showing 404 page, my code's are following

app\etc\modules\SilverExchange_Declaration.xml

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <SilverExchange_Declaration>
            <active>true</active>
            <codepool>local</codepool>
        </SilverExchange_Declaration>
    </modules>
</config>

app\code\local\SilverExchange\Declaration\etc\config.xml

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <SilverExchange_Declaration>
            <version>0.1.0</version>
        </SilverExchange_Declaration>
    </modules>
    <global>
            <blocks>
                <silverexchange_declaration>
                    <class>SilverExchange_Declaration_Block</class>
                </silverexchange_declaration>
            </blocks>
        </global>
    <frontend>
        <routers>
            <declaration>
                <use>standard</use>
                <args>
                    <module>SilverExchange_Declaration</module>
                    <frontname>declaration</frontname>
                </args>
            </declaration>
        </routers>
        <layout>
            <updates>
                <declaration>
                    <file>declaration.xml</file>
                </declaration>
            </updates>
        </layout>
    </frontend>
</config>

app\code\local\SilverExchange\Declaration\controllers\IndexController.php

<?php  

class SilverExchange_Declaration_IndexController extends Mage_Core_Controller_Front_Action
{

    public function IndexAction()
    {
        echo "HI fill your Declaration here";
    }
    Zend_Debug::dump($this->getLayout()->getUpdate()->getHandles());die; 
}

app\code\local\SilverExchange\Declaration\Block\Declaration.php

<?php
class SilverExchange_Declaration_Block_Declaration extends Mage_Core_Block_Template {

}

app\design\frontend\coolbaby\default\layout\declaration.xml

<?xml version="1.0" encoding="UTF-8"?>
<layout version="0.1.0">
  <declaration_index_index>
    <reference name="content">
      <block type="silverexchange_declaration/helloWorld" name="declaration_any_block" template="declaration/index.phtml" />
    </reference>
  </declaration_index_index>
</layout>

app\design\frontend\coolbaby\default\template\declaration\index.phtml

<?php
echo "Hi there";

link http://127.0.0.1/ramesh/sliver-exchange/declaration enter image description here

Something i miss here...!

1

Your code contains several errors !

app\etc\modules\SilverExchange_Declaration.xml

<?xml version="1.0" encoding="UTF-8"?>
    <config>
        <modules>
            <SilverExchange_Declaration>
                <active>true</active>
                <codePool>local</codePool>
            </SilverExchange_Declaration>
        </modules>
    </config>

app\code\local\SilverExchange\Declaration\etc\config.xml

...
<frontName>declaration</frontName>
...

app\design\frontend\coolbaby\default\layout\declaration.xml

<?xml version="1.0" encoding="UTF-8"?>
<layout version="0.1.0">
    <declaration_index_index>
        <reference name="content">
            <block type="declaration/declaration" name="declaration_any_block" template="declaration/index.phtml" />
        </reference>
    </declaration_index_index>
</layout>

app\code\local\SilverExchange\Declaration\controllers\IndexController.php

<?php  

class SilverExchange_Declaration_IndexController extends Mage_Core_Controller_Front_Action
{

    public function indexAction()
    {
        $this->loadLayout();
        $this->renderLayout();
    }
}

To access your module: www.domaine.com/declaration

EDIT:

To set your layout to 1column:

<?xml version="1.0" encoding="UTF-8"?>
    <layout version="0.1.0">
        <declaration_index_index>
            <reference name="root">
                <action method="setTemplate"><template>page/1column.phtml</template></action>
                <action method="setHeaderTitle" translate="title" module="declaration"><title>Declaration</title></action>
            </reference>
            <reference name="content">
                <block type="declaration/declaration" name="declaration_any_block" template="declaration/index.phtml" />
            </reference>
        </declaration_index_index>
    </layout>
  • Thanks Prince its working fine but i need full width page. Your code 2columns-left can you please give me for 1columns – Ramesh S Sep 1 '17 at 12:14
  • I got the solution <reference name="root"> <action method="setTemplate"><template>page/1column.phtml</template></action> </reference> thanks for your code – Ramesh S Sep 1 '17 at 12:19
  • Please, look my update – PЯINCƏ Sep 1 '17 at 12:23
  • I think i did small mistake <frontname>declaration</frontname> am i correct – Ramesh S Sep 1 '17 at 12:29
  • Not just this one, all the files that i mentionned in my answer – PЯINCƏ Sep 1 '17 at 12:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.