Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using getChildHtml inside included template magento

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

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

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

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

like image 980
Alan Whitelaw Avatar asked Apr 14 '11 09:04

Alan Whitelaw


1 Answers

You are getting in to "world inside a world that is bigger than the world that you are inside" syndrome here. You can't use it because head is not defined a child of your block that you are currently in.

try this instead:

<?php echo $this->getLayout()->getBlock('head')->toHtml();?> 
like image 92
Anton S Avatar answered Nov 07 '22 07:11

Anton S