Magento:xml 块加倍
cms.xml 具有默认值:
<default>
<reference name="footer">
<block type="cms/block" name="cms_footer_links" before="footer_links">
<action method="setBlockId"><block_id>footer_links</block_id></action>
</block>
</reference>
</default>
我的 local.xml 具有以下内容:
<default>
<reference name="footer">
<remove name="store_switcher" />
<remove name="footer_links" />
<block type="page/html_wrapper" name="footer.links.wrapper" translate="label" before="-">
<label>Footer Links Wrapper</label>
<action method="setElementClass"><value>bottomLinks</value></action>
<block type="cms/block" name="cms_footer_links">
<action method="setBlockId"><block_id>footer_links</block_id></action>
</block>
</block>
</reference>
</default>
但在这种情况下,我得到了双倍的 footer_links 块。第一个是在页面静态块中,另一个是包装到 div.bottomLinks 中。
如何解决这个问题?如何在不编辑 cms.xml 的情况下仅显示一个包装块?
cms.xml has default value:
<default>
<reference name="footer">
<block type="cms/block" name="cms_footer_links" before="footer_links">
<action method="setBlockId"><block_id>footer_links</block_id></action>
</block>
</reference>
</default>
My local.xml has follow content:
<default>
<reference name="footer">
<remove name="store_switcher" />
<remove name="footer_links" />
<block type="page/html_wrapper" name="footer.links.wrapper" translate="label" before="-">
<label>Footer Links Wrapper</label>
<action method="setElementClass"><value>bottomLinks</value></action>
<block type="cms/block" name="cms_footer_links">
<action method="setBlockId"><block_id>footer_links</block_id></action>
</block>
</block>
</reference>
</default>
But in this case I get doubled footer_links block. The first one is as it is in a page static block, the other one is wrapped into div.bottomLinks.
How to fix this? How to show only one wrapped block without cms.xml editing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在本地 xml 中尝试此操作
,并且
您应该将名称更改为“cms_footer_another_links”之类的名称。
好吧,我希望我答对了你的问题。
更新1
默认部分已加载到各处。所以如果我正确理解你只需要 1 个块实例。
尝试以下(local.xml):
或
Try this in local xml
And in
You should change name to something like "cms_footer_another_links".
Well I hope I got your question right.
UPDATE 1
default section is loaded everywhere. So IF I correctly understood u want only 1 single instance of block.
Try the following(local.xml):
OR
您的删除标签包含错误的块名称。它应该是
而不是
。Your remove-tag contains the wrong block name. It should be
<remove name="cms_footer_links" />
instead of<remove name="footer_links" />
.