在CMS主页上添加自定义块
-
16-10-2019 - |
题
我想修改布局 page.xml
在 layout
CMS的文件夹 home
页。
这是原始的XML代码,
<block type="core/text_list" name="content" as="content" translate="label">
<label>Main Content Area</label>
</block>
此代码似乎拉动了您在CMS中输入的任何内容 home
通过管理区域的页面。
因此,我想在该块内添加一个自定义块,例如
<block type="core/text_list" name="content" as="content" translate="label">
<label>Main Content Area</label>
<block type="page/html_topmenu" name="catalog.topnav" template="page/html/topmenu.phtml"/>
</block>
它有效。但是如何添加我想在下面创建的自定义块 app/design/frontend/MY_LOCAL/template/cms/default/home.phtml
?
<block type="core/text_list" name="content" as="content" translate="label">
<label>Main Content Area</label>
<block type="page/html_content" name="content" template="cms/default/home.phtml"/>
</block>
什么都没有。 Magento根本没有拉动模板文件的块。
有任何想法吗?
解决方案
我认为这里有两个问题。首先 type
或您的街区上课可能是错误的,其次是 name
应该是唯一的。
<block type="core/text_list" name="content" as="content" translate="label">
<label>Main Content Area</label>
<block type="core/template" name="some_random_name" template="cms/default/home.phtml"/>
</block>