Layout of your custom controller in Magento?

When you work with custom (your own) controllers in Magento,
either frontend or backend, you will probably also use existing blocks and models or if needed write your own classes.
But what happens if you want to or have exigency to move/remove common blocks?
Can you really “design” your own page view without touching Cascading Style Sheets?

Acctually, yes you can, as a matter of fact on a pretty easy way.
All you need to know the handles of your controllers.
You know what handles are, right ?

To get handle of your controller, you will need some debugging techniques.
In action of your controller insert line:

Zend_Debug::dump($this->getLayout()->getUpdate()->getHandles());

It works for admin and frontend cotrollers in a same way.
And your custom action will look something like this:

Now, when you know the handles you can start working with your layout xml files.
All you need is to create “local.xml” file in layout folder of your theme (frontend or admin) and do the updates.
In my, simple, example I have removed headers and footers on both, frontend and admin controllers.

Please help me, i created my own theme and local.xml file which i use to modify my layout but whatever the changes am doing don’t reflect into my website.my website still under development,not yet live please help.

Thanks for the hint, that filled the gap I was searching for a day. A bit strange, that this isn’t mentioned in all the basic-module-setup-tutorials, ’cause loading a template for your module seems to be a very basic need.
The tutorial on the magentocommerce.com suggests the handle is the module-name with _index_index behind, but without the namespace, which turns out to be required… but when you suggest to ask the getHandles()-function the principle behind this seems to be more complicate – it still would be nice to understand.
…still not getting the principle, but a step further,
johannes

Your email address will not be published. Required fields are marked *

Comment

You may use these HTML tags and attributes: <a href="" title=""> <blockquote cite=""> <code> <del datetime=""> <em> <s> <strike> <strong>. You may use following syntax for source code: <pre><code>$current = "Inchoo";</code></pre>.