Magento – getChildHtml – remove specific block after call

blocksfrontendlayout

I want to output a specific child block at a specific place in a template. I am using:

echo $this->getChildHtml('block_name')

Obviously this works.

However, in the same template there is a later call:

echo $this->getChildHtml()

with no parameter

Clearly this outputs the block twice.

Is there any way to avoid this and make the block only possible to output once and still retain the same functionality as above – i.e. output a specific block at a specific place and then all other children later in the template?

Best Answer

Try

unset($this->_childrenHtmlCache['block_name']);
$this->unsetChild('block_name');
Related Topic