Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <layout>
- <catalog_category_default>
- <!-- block gets added -->
- <reference name="content">
- <block type="core/text" name="are_you_sure"></block>
- </reference>
- </catalog_category_default>
- <catalog_category_default>
- <!-- later, a different handle gets a reference and sets block state -->
- <reference name="are_you_sure">
- <action method="setText"><text>Hello World</text></action>
- </reference>
- </catalog_category_default>
- <catalog_category_default>
- <!-- we want to move a block, so we unset where it is -->
- <reference name="content">
- <action method="unsetChild"><child>are_you_sure</child></action>
- </reference>
- </catalog_category_default>
- <catalog_category_default>
- <!-- WRONG WAY: we re-add the block, but we've lost state -->
- <reference name="right">
- <block type="core/text" name="are_you_sure"/>
- </reference>
- </catalog_category_default>
- <catalog_category_default>
- <!-- Instead, use the insert method. This method accepts both a block object
- OR a string. If you pass it a string, it gets a refernce to the block by that
- name. The block, although unset, still exists on the layout object, which is why
- this works -->
- <reference name="right">
- <action method="insert"><block>are_you_sure</block></action>
- </reference>
- <!--
- if (is_string($block)) {
- $block = $this->getLayout()->getBlock($block);
- }
- -->
- </catalog_category_default>
- </layout>
Add Comment
Please, Sign In to add comment