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

How to tell which layout is being loaded? 
 
Jawbreak
Jr. Member
 
Total Posts:  22
Joined:  2008-04-25
 

How can you tell which layout file is being used when a page is loaded?  Also, within the xml files there are the different handles, so how do you know what these should be and which ones are being used?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Wiseguy Digital
Member
 
Avatar
Total Posts:  61
Joined:  2007-09-17
Bristol, UK
 

Hey Jawbreak, to start with you can simply add a visual guide in the layout pages to know which ones are being used. So each of the page layouts up and add it’s name in an HTML tag e.g.

Open 3columns.phtml and then wherever you think it would be most visible add:

<pre>3columns.phtml</pre>

Do this for each page and then have a good browse through the site until you know roughly which pages use which template. Eventually you can just delete these entries.

Hope that helps,

jim

 
Magento Community Magento Community
Magento Community
Magento Community
 
glaDiator
Member
 
Avatar
Total Posts:  65
Joined:  2008-03-17
 

Turn on the Templates path hints from admin panel......... it will show you the details of every page while u browse.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Jawbreak
Jr. Member
 
Total Posts:  22
Joined:  2008-04-25
 
glaDiator - 28 April 2008 02:41 AM

Turn on the Templates path hints from admin panel......... it will show you the details of every page while u browse.

Yeah I’ve done this, but this only tells you what template files are being called and not what layout(xml) files is being used to create the page.  So when designing our site, we don’t need to worry about the layout files?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Wiseguy Digital
Member
 
Avatar
Total Posts:  61
Joined:  2007-09-17
Bristol, UK
 

Ah sorry I misread your needs. The XML template files are fairly well named. The key file is page.xml as it defines the standard overall elements on the page and the next I would say is catalog.xml which sets up most of the sections used in the store.They tend to be well named, but so far it has been some trial and error for me.

I don’t know of a way of displaying this - it may be shown in the debugger, but I have not checked.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Jawbreak
Jr. Member
 
Total Posts:  22
Joined:  2008-04-25
 
ohminu - 28 April 2008 01:43 PM

@Jawbreak-

Template hints are actually a good reference point (for what layout files are being called) for the following reason:
When the template hints displays the path of each template, it does so by revealing the name of the module that the template interacts with.
For instance, say the hints displays a template path like ‘app/design/frontend/default/default/checkout/cart/sidebar.phtml’. You will know that the page calls the layout ‘checkout.xml’, because of the layout files are all named after its module, and the template files are all organized on a per module basis.

So if the template path says:
- ‘app/design/frontend/default/default/catalog/template_name.phtml’, you know that the layout ‘catalog.xml’ is loaded in the page
- ‘app/design/frontend/default/default/contacts/template_name.phtml’, you know that the layout ‘contacts.xml’ is loaded in the page
- so on and so forth…

As to the handlers, the layout files are well commented, so by virtue of reading the comments and trying things for yourself, you should be able to figure things out.

Thanks for the replies.

Does this mean more than one layout(xml) file is called per page?

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