Reputation: 4349
I have a custom template block (phtml) that is defined like this:
<block type="catalog/product" name="a.unique.name" template="dir/dir/customlist.phtml"/>
that is defined in CMS home page within this block
<reference name="left">
However if I move it to header block, it does not appear
<reference name="header">
What am I missing here?
** ---- addition -----
I tried this as suggested by D. Sloof, but it does not work. (I suspect more due to my mis-actions than his explanation.)
I added getChildHtml('customlist'); ?> to
mytheme\template\page\html\header.phtml
just under div "top-col-1"
<div class="wrapper">
<div class="top-col-1">
<?php echo $this->getChildHtml('customlist'); ?>
where "customlist" can befound in
mytheme/template/dir/dir/customlist.phtml
What am I doing wrong?
Upvotes: 1
Views: 573
Reputation: 2527
got it...
block name a.unique.name in xml file
<block type="catalog/product" name="a.unique.name" template="dir/dir/customlist.phtml"/>
must match what is called in mytheme\template\page\html\header.phtml
<?php echo $this->getChildHtml('a.unique.name'); ?>
Upvotes: 1
Reputation: 12706
The header
block is of type Mage_Page_Block_Html_Header
and will not automatically render child blocks. You can have a look at the template file page/html/header.phtml
how the child block html is retrieved.
You essentially have 2 options:
getChildHtml
call in the header template (by copying it to your own theme), or;left
block is of type Mage_Core_Block_Text_List
which will do this. There is a similar block inside the header
block called top.container
that is of type Mage_Page_Block_Html_Header
that will do this as well: you can reference this block instead.Upvotes: 0