php - Magento: IndexController doesn't load phtml file -
as mentioned in title can't indexcontroller load view.phtml within it's index (or other) action. can tell me i'm doing wrong/missing. here got:
app/etc/modules/namespace_mymodule.xml
<?xml version="1.0"?> <config> <modules> <namespace_mymodule> <active>true</active> <codepool>local</codepool> </namespace_mymodule> </modules> </config>
app/code/local/namespace/mymodule/etc/config.xml
<?xml version="1.0" encoding="utf-8"?> <config> <modules> <namespace_mymodule> <version>0.3</version> </namespace_mymodule> </modules> <frontend> <layout> <updates> <namespace_mymodule> <file>mymodule.xml</file> </namespace_mymodule> </updates> </layout> <routers> <namespace_mymodule> <use>standard</use> <args> <module>namespace_mymodule</module> <frontname>something</frontname> </args> </namespace_mymodule> </routers> </frontend> </config>
app/design/frontend/default/namespace/layout/mymodule.xml
<?xml version="1.0" encoding="utf-8"?> <layout version="0.1.0"> <something_index_index> <reference name="content"> <block type="core/template" name="namespace_mymodule_view" template="mymodule/view.phtml" /> </reference> </something_index_index> </layout>
app/code/local/namespace/mymodule/controllers/indexcontroller.php
<?php class namespace_mymodule_indexcontroller extends mage_core_controller_front_action { public function indexaction() { $this->loadlayout(); $this->renderlayout(); } }
app/design/frontend/default/namespace/template/mymodule/view.phtml
<h1><?php echo "what ever"; ?></h1>
you did mistake in layout file. have specify handle like
frontname_controller_action
so try code
<layout version="0.1.0"> <something_index_index> <reference name="content"> <block type="core/template" name="namespace_mymodule_view" template="mymodule/view.phtml" /> </reference> </something_index_index> </layout>
Comments
Post a Comment