I'm having a bit of trouble with a custom layout block which I'm trying to add to the head.phtml file of my theme. Basically, I'm trying to add extra favicon definitions to the header of my document.
In my local.xml file, I've added the lines:
<default>
<reference name="head">
<block type="core/template" name="favicon.extra" as="favicon.extra" template="page/html/head/favicon-extra.phtml" />
</reference>
</default>
And then inside head.phtml, I'm calling this as a childHtml template as:
<link rel="icon" href="<?php echo $this->getFaviconFile(); ?>" type="image/x-icon" />
<link rel="shortcut icon" href="<?php echo $this->getFaviconFile(); ?>" type="image/x-icon" />
<?php echo $this->getChildHtml('favicon.extra') ?>
The problem is that the block is rendered twice, in two different spots:
- Underneath the other favicons, as per the head.phtml getChildHtml call, and
- After the other scripts in the header
The desired outcome is that I only want the first of these two to render.
From what I've read, I think this has to do with that particular block/reference being automatically rendered via the toHtml output - is this correct?
If so, is there a better/correct way to accomplish what I'm trying to do here? Is there another way to remove the second render?
Any help possible is much appreciated.
Note: apologies if this is considered bad practice but I'm reposting a question I posted on StackOverflow (https://stackoverflow.com/questions/25348878/layout-xml-block-rendered-twice-in-magento-skin) as I thought this might be a more appropriate forum.