Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Purpose of the “UPDATE” layout tag ? 
 
Peppermay
Sr. Member
 
Avatar
Total Posts:  111
Joined:  2008-10-18
Lille, France
 

Good morning to this side of the earth, and good evening to the other half.

Could somebody explain me what’s the purpose of the UPDATE XML tag we can meet in layout files, e.g.
<update handle="catalog_seo_sitemap" />

many thanks in advance.

 
Magento Community Magento Community
Magento Community
Magento Community
 
LeeSaferite
Guru
 
Avatar
Total Posts:  322
Joined:  2007-08-31
Lake City, FL
 

It means, Take the layout update handle <catalog_seo_sitemap> and merge it’s contents with the current layout xml. 

It’s a way of modularizing the layout XML into multiple handles.

So, if you have this:

<layout>
   <
some_handle>
      <!-- 
Layout XML Chunk #1 -->
      
<update handle="different_handle" /> 
   </
some_handle>
   <
different_handle>
      <!-- 
Layout XML Chunk #2 -->
   
</different_handle>
</
layout>

You effectively have

<layout>
   <
some_handle>
      <!-- 
Layout XML Chunk #1 -->
      
<!-- Layout XML Chunk #2 -->
   
</some_handle>
</
layout>
 
Magento Community Magento Community
Magento Community
Magento Community
 
Peppermay
Sr. Member
 
Avatar
Total Posts:  111
Joined:  2008-10-18
Lille, France
 

Great !
Fast, clear and precise.
Thank you Lee, and good morning to Florida !

 
Magento Community Magento Community
Magento Community
Magento Community
 
Ricardo_Martins
Member
 
Avatar
Total Posts:  48
Joined:  2009-02-04
Santos, SP, Brazil
 
LeeSaferite - 02 March 2009 01:48 AM

It means, Take the layout update handle <catalog_seo_sitemap> and merge it’s contents with the current layout xml. 

It’s a way of modularizing the layout XML into multiple handles.

So, if you have this:

<layout>
   <
some_handle>
      <!-- 
Layout XML Chunk #1 -->
      
<update handle="different_handle" /> 
   </
some_handle>
   <
different_handle>
      <!-- 
Layout XML Chunk #2 -->
   
</different_handle>
</
layout>

You effectively have
<layout>
   <
some_handle>
      <!-- 
Layout XML Chunk #1 -->
      
<!-- Layout XML Chunk #2 -->
   
</some_handle>
</
layout>

That’s almost perfect for me, lol.

See, Im making an admin module, that has a controller called UploadController.php inside /Timepix/MediaUploader/controllers/Adminhtml/UploadController.php…

But in its layout.xml, I need to use:

<layout>
    <
mediauploader_adminhtml_upload_index>
        <
update handle="mediauploader_upload_index"/>
        <
reference name="content">
            <
block type="adminhtml/template" name="form" template="mediauploader/form.phtml"/>
        </
reference>
    </
mediauploader_adminhtml_upload_index>
</
layout>

We all know that the handle name is (always?): [controllername]_[frontname]_[actionname].
So I asked myself: why the update handle doesnt have the frontName of the request?

In my config, i declared the frontName node as mediauploader. So, when I request
http://mystore.com/index.php/mediauploader/adminhtml_upload
I noticed that I got an additional handle there:

mediauploader_adminhtml_upload_index that finally calls
mediauploader_upload_index

Why in the admin I dont have the [frontname] in the handle name?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top