问题
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