如何在不点击模块名称的情况下在包括主页在内的所有页面中可见的右栏中创建一个 block ?
谢谢。
最佳答案
希望能够很好地理解您的问题...
1) 创建模块(例如 Mynamespace/Mymodule)
2) 在模块中创建一个 block (例如 Mynamespace/Mymodule/Block/Myblock)
3) 为该 block 创建一个 phtml 文件 (YOURTHEMEDIR/template/mymodule/myblock.phtml)
4) 编辑模块“Mymodule”的 config.xml,使其加载布局更新文件 (YOURTHEMEDIR/layout/mymodule.xml):
<frontend>
...
<layout>
<updates>
<mymodule>
<file>mymodule.xml</file>
</mymodule>
</updates>
</layout>
...
</frontend>
5)在 mymodule.xml 中添加如下内容:
<?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>
关于xml - Magento - 在所有页面中创建固定 block ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4449832/