Using getChildHtml inside the included magento template

I am trying to use $this->getChildHtml('head') from inside the page/html/header.phtml file in Magento.

Using $this->getChildHtml('head') inside the page/1column.phtml works as expected.

Can someone point me in the right direction to understand how $this magic is used in templates?

I think this question, Magento - using $ this-> getPriceHtml on a custom page template is on the right lines, but I'm still missing something. Thanks

+6
source share
1 answer

You get here in the "world inside the world, which is larger than the world that you are inside." You cannot use it because the head is not defined by the child of your block in which you are currently located.

try this instead:

 <?php echo $this->getLayout()->getBlock('head')->toHtml();?> 
+19
source

Source: https://habr.com/ru/post/885893/


All Articles