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...!

3
  • 1
    Can you please try 127.0.0.1/ramesh/declaration Commented Sep 1, 2017 at 11:21
  • @MoinMalek: Thanks for reply sliver-exchange is my root folder name . This is my actual http://127.0.0.1/ramesh/sliver-exchange/ Commented Sep 1, 2017 at 12:04
  • Please try it 127.0.0.1/ramesh/declaration/index Commented Sep 4, 2017 at 4:12

1 Answer 1

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> 
6
  • Thanks Prince its working fine but i need full width page. Your code 2columns-left can you please give me for 1columns Commented Sep 1, 2017 at 12:14
  • I got the solution <reference name="root"> <action method="setTemplate"><template>page/1column.phtml</template></action> </reference> thanks for your code Commented Sep 1, 2017 at 12:19
  • Please, look my update Commented Sep 1, 2017 at 12:23
  • I think i did small mistake <frontname>declaration</frontname> am i correct Commented Sep 1, 2017 at 12:29
  • Not just this one, all the files that i mentionned in my answer Commented Sep 1, 2017 at 12:33

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.