3

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?

1 Answer 1

5

Try

unset($this->_childrenHtmlCache['block_name']);
$this->unsetChild('block_name');
2
  • Where would this go? Apr 22, 2013 at 21:06
  • In your template file below echo $this->getChildHtml('block_name'). Apr 23, 2013 at 7:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.