Magento 商店 - 使用更新 XML 删除块 [英] Magento Store - Remove Block using Update XML

查看:30
本文介绍了Magento 商店 - 使用更新 XML 删除块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在模板文件中使用此代码在左侧边栏中显示静态块:

I am using this code in my template file to display a static block in my left sidebar:

<?= $this->getLayout()->createBlock('cms/block')->setBlockId('leftSB1')->toHtml() ?>

我想从我的 CMS 页面之一中排除该块.我该怎么做?

I would like to exclude the block from one of my CMS pages. How do I do this?

我认为这需要向布局更新 XML"部分添加代码,但我不确定具体是什么.

I think it requires adding code to the 'Layout Update XML' section but I'm not sure what exactly.

推荐答案

改为在布局中包含块:

<cms_page>
  <reference name="left">
    <block type="cms/block" name="leftSB1">
      <action method="setBlockId"><id>leftSB1</id></action>
    </block>
  </reference>
</cms_page>

然后 $this->getChildHtml('leftSB1') 在您的侧边栏中,如果您没有自动包括孩子.

And then $this->getChildHtml('leftSB1') in your sidebar, if you're not including children automatically.

(然后像上一个答案一样将其从特定页面中删除)

(and then remove it from the particular page as in the previous answer)

这篇关于Magento 商店 - 使用更新 XML 删除块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆