xml - How to set up custom block in layout file? -
i can't setup block in advancedsearch.xml layout. extension has name rockstar_chatattributes. here config.xml(just necessary nodes):
<?xml version="1.0"?> <config> <modules> <rockstar_chatattributes> <version>1.0.0</version> </rockstar_chatattributes> </modules> <global> <blocks> <chatattributes> <class>rockstar_chatattributes_block</class> </chatattributes> </blocks> </global> <frontend> <routers> <chatattributes> <use>standard</use> <args> <module>rockstar_chatattributes</module> <frontname>advancedsearch</frontname> </args> </chatattributes> </routers> <layout> <updates> <chatattributes> <file>advancedsearch.xml</file> </chatattributes> </updates> </layout> </frontend>
here advancedsearch.xml:
<layout version="0.1.0"> <chatattributes_index_index> <reference name="content"> <block type="chatattributes/john" name="john" as="john" template="chatattributes/john/view.phtml" /> </reference> </chatattributes_index_index>
here /app/design/frontend/default/mytemplate/template/chatattributes/john/view.phtml locating template
here block(app/code/local/rockstar/chatattributes/block/john.php):
class rockstar_chatattributes_block_john extends mage_core_block_template { public function logic() { echo 'block has been included'; } }
so block ignoring. when type core/template instead chatattributes/john in advancedsearch.xml, text in template displaying fine.
check layout version's value. of 0.1.0
in advancedsearch.xml
, config.xml's version
of 1.0.0
. think here might mistake. versions of these 2 files must have same. change valuesin 1 of file.
Comments
Post a Comment