Layout files are XML files that control the position of blocks.
Each module has a layout file that is in charge of updating that specific module layout.
<reference name="content"> <block name="giftregistry.list" type="mdg_giftregistry/list" template="mdg/list.phtml" as="giftregistry_list"/> </reference> Provide breakdown of each of the parts of the layout.xml syntax
With regards to the layout xml file, here are some thing to note:
There are three main nodes:
- handle – this appease directly after the layout (version: optional) node and will be either default (used for setting global blocks), or defined by the combination of
_ _ .
- reference – used to make references to a block. Useful for specifying nested blocks or modifying existing blocks.
- block – this node loads the block. This is achieved with the use of defined properties, which are specified through the following:
- type – The identifier of the block class. E.g., catalog/product_list actually refers to Mage_Catalog_Block_Product_List.
- name – an internal handle that is used by other blocks to reference this block.
- before/after – used for block positioning relative to another block. These properties will also accept a ‘-‘ (dash/hyphen) character to specify that the block should appear at the very top or very bottom.
- template – defines the .pthml file that will be used in rendering the block.
- as – using this allows the specification of the unique identifier that will be used for calling the block from the template, such as calling a child block by using getChildHtml(‘block_name’).