0

I want to add a block in left column of only my module, not whole website.

If I place it in <default> tag it will be shown in whole website, but I want to do something like <mymodule_default>, is it possible ?

I know I can place my block in every layout_handler like

 <mymodule_controllername_actionname>
    <reference name="left">
        <block type="mymodule/block" name="left_navigation" before="-" template="mymodule/left-nav.phtml" />
    </reference>
 </mymodule_controllername_actionname>

but this is not what I want, I want to do it as

 <mymodule_default>
    <reference name="left">
        <block type="mymodule/block" name="left_navigation" before="-" template="mymodule/left-nav.phtml" />
    </reference>
 </mymodule_default>

Or it is not preferable ?? Thanks

1 Answer 1

1

You can only add layout update handle in each controller

public function preDispatch()
{
    parent::preDispatch();
    $this
        ->getLayout()
        ->getUpdate()
        ->addHandle('mymodule_default');
}

Or with instruction <update handle="mymodule_default"/> in all <mymodule_controllername_actionname> handles

Example:

<mymodule_controllername_actionname>
    <update handle="mymodule_default"/>
    ...
<mymodule_controllername_actionname>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.