Guest User

Untitled

a guest
Jan 22nd, 2018
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. <layout>
  2. <catalog_category_default>
  3. <!-- block gets added -->
  4. <reference name="content">
  5. <block type="core/text" name="are_you_sure"></block>
  6. </reference>
  7. </catalog_category_default>
  8.  
  9. <catalog_category_default>
  10. <!-- later, a different handle gets a reference and sets block state -->
  11. <reference name="are_you_sure">
  12. <action method="setText"><text>Hello World</text></action>
  13. </reference>
  14. </catalog_category_default>
  15.  
  16. <catalog_category_default>
  17. <!-- we want to move a block, so we unset where it is -->
  18. <reference name="content">
  19. <action method="unsetChild"><child>are_you_sure</child></action>
  20. </reference>
  21. </catalog_category_default>
  22.  
  23. <catalog_category_default>
  24. <!-- WRONG WAY: we re-add the block, but we've lost state -->
  25. <reference name="right">
  26. <block type="core/text" name="are_you_sure"/>
  27. </reference>
  28. </catalog_category_default>
  29.  
  30. <catalog_category_default>
  31. <!-- Instead, use the insert method. This method accepts both a block object
  32. OR a string. If you pass it a string, it gets a refernce to the block by that
  33. name. The block, although unset, still exists on the layout object, which is why
  34. this works -->
  35. <reference name="right">
  36. <action method="insert"><block>are_you_sure</block></action>
  37. </reference>
  38. <!--
  39. if (is_string($block)) {
  40. $block = $this->getLayout()->getBlock($block);
  41. }
  42. -->
  43. </catalog_category_default>
  44.  
  45. </layout>
Add Comment
Please, Sign In to add comment