Articles in this series

Author - Paryank Kansara

I have extensive experience in web development of community based and enterprise level applications. My expertise includes sectors like: e-Commerce, Social Networking Portals, Content Management Systems, etc.

More Info » Follow me on Twitter »

Reader Comments (16)

  1. Digging Deeper Into Magento’s Layout XML – Part 2 | Magento Training Course

    [...] Magneto’s layout rendering process and gives more insight into layout handles and updates. Link – Trackbacks source: Topsy – magento tutorial – Digging Deeper Into Magento’s [...]

  2. Happy
    Happy
    January 30, 2011 at 11:10 am /

    Thanks for Part 2, it covers some things i’ve not seen mentioned elsewhere. Such as the fact you can use block names in after and before rather than having to depend on the parent.

    I’m having troubles with this though. I have a block that displays on the shipment view page in the admin area. That works fine however I cant see to get my block to appear exactly where I want it. I want to display it between the block order_payment and shipment_tracking … so I try passing after=”order_payment”. This just displays my block at the very end of the page, after all other blocks. I also tried before=”shipment_tracking” however this again just displays my block at very start of page before all other blocks.

    So it seems I can get my block to display before and after all other blocks, but cannot nest it inbetween blocks.

    Is this something you have seen before or have an idea on?

    cheers,
    happy

    Reply
    1. Robert
      January 30, 2011 at 12:32 pm /

      @Happy

      Trying to get a specific order for your blocks in the layout xml can sometimes be a challenge and requires some ‘voodoo’. You will need to check all the before and after attribute values for the blocks you are trying to nest between, sometimes they have their own values already and in that case you may need to change those first.

      Reply
  3. naff
    naff
    February 3, 2011 at 8:55 am /

    Thanks so much for the great article.

    I must say that I like the way you explain everything so that’s it’s very easy to understand.

    Thanks so much.

    Reply
  4. Magento小工
    April 18, 2011 at 4:53 am /

    Very good and usefull info about magento layout and blocks, I like it! Thanks a lot!

    Reply
  5. 5 Useful Tricks For Your Magento local.xml – Tutorials – Magebase

    [...] have covered a lot about Magento’s layout XML in our past 2 articles [1] [2]. We saw that Magento will read the layout XML files in a specific order and that the local.xml file [...]

  6. Danny
    Danny
    August 10, 2011 at 7:14 am /

    Thank you for this great article!

    Reply
  7. Creating Custom Layout Handles – Tutorials – Magebase

    [...] discussed in previous articles about Magento’s Layout XML, Layout Handles in Magento’s layout XML are XML nodes which contain the definition of updates in page [...]

  8. 5 Useful Tricks For Your Magento local.xml | 奇才哥的外贸B2C SEO,SEM点滴

    [...] have covered a lot about Magento’s layout XML in our past 2 articles [1] [2]. We saw that Magento will read the layout XML files in a specific order and that [...]

  9. SS
    SS
    January 1, 2012 at 6:33 am /

    Block Name and Alias <— I think that was maybe a headline not in the pinn about "least one output block" ?

    Reply
  10. Travis
    Travis
    May 2, 2012 at 11:24 pm /

    Hi, great explanation. First one I’ve seen about non-output blocks. However, I’m still not clear on it.
    For example I have a block that is:

    <reference name="product.info">
        	<block type="freegift/freeproduct"  template="mw_freegift/catalog_gift.phtml" name="freegift.other" as="other" />
    </reference>
    

    The block appears after all other blocks in the “product.info” parent block.
    I tried added before=”-” and before=”other_block_names” to the block type line above but it didn’t do anything.
    I then found the parent block template uses a getChildHtml(‘other’) and displays this block, at the point where that getChildHtml() code is.
    Effectively, the before attribute is irrelevant in this case.

    Does this mean it is a non-output block?
    Looking at the function for it

    class MW_FreeGift_Block_Freeproduct extends Mage_Core_Block_Template
    

    Does this mean that Mage_Core_Block_Template is a non-output block?

    How do you know?

    Your list of block types on the first part of this tutorial don’t identify whether they are non-output types. I can find any other references to your discussion of non-output blocks???

    “As explained earlier, the non-output blocks are child blocks of output blocks and are normally rendered…. ”

    Thanks
    Trav

    Reply
  11. Ceniy
    Ceniy
    July 6, 2012 at 3:16 pm /

    Very easy to understand. Thanks a lot.

    Reply

Add a Comment & Join the Discussion

Insert small snippets of code by using [code]{your_code_here}[/code]
For larger code blocks please use http://pastebin.com and paste your link.

You may also use the following HTML in your comment: <a href="" title=""> <abbr title="">
<acronym title=""> <blockquote cite=""> <cite> <em> <strike> <strong>