Magento - display block but only show when I call it with getChildHtml

跟風遠走 提交于 2019-12-10 16:59:08

问题


I have created a block and I have placed it in to the layout xml and it is showing correctly in my theme. My problem is that I actually don't want it to display until I explicitly call it with getChildHtml('myblock').

My block xml looks like this:

<block type="page/html" name="myblock" as="myblock" template="page/html/myblock.phtml"/ >

Anyone have a clue how to achieve this?

Thanks


回答1:


Place your block inside another that is neither a core/list type nor calls $this->getChildHtml('') (note the empty string). That way it will not be shown automatically and you are free to call it at your discretion.



来源:https://stackoverflow.com/questions/5908904/magento-display-block-but-only-show-when-i-call-it-with-getchildhtml

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!