开发者

Magento - create a fixed block in all pages

how can I create a block in the right column visible in all page开发者_开发问答s including the homepage without taping the module name?

Thank you.


Hoping to have understood well your question...

1) Create a module (for example Mynamespace/Mymodule)

2) Create a block in your module (for example Mynamespace/Mymodule/Block/Myblock)

3) Create a phtml file for that block (YOURTHEMEDIR/template/mymodule/myblock.phtml)

4) Edit config.xml of the module "Mymodule" so that it will load a layout update file (YOURTHEMEDIR/layout/mymodule.xml):

<frontend>
...
<layout>
    <updates>
    <mymodule>
        <file>mymodule.xml</file>
    </mymodule>
    </updates>
</layout>
...
</frontend>

5) Inside your mymodule.xml put something like this:

<?xml version="1.0"?>
<frontend>
    <layout>
        <default>
            <reference name="right">  <!-- this is the name of the right column block -->
                <block type="mymodule/myblock" name="myblock" template="mymodule/myblock.phtml" /> 
            </reference>
        </default>
    </layout>
</frontend>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜