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?
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.
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?
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.
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.
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?