I think I have a little understanding problem how magento layout works.

I have a template page/2columns-left.phtml with the following code in it:

<?php echo $this->getChildHtml('head') ?>

Now in the page.xml I have:

<block type="page/html" name="root" output="toHtml" template="page/2columns-left.phtml">
    <block type="page/html_head" name="head" as="head">
<!-- Here comes my new block -->
        <block type="core/template" name="headmeta" template="page/html/head.phtml"/>

As you can see I want to include the page/html/head.phtml in this block. My first confusion was the block type. As I don't have any class to this template (I only have the phtml) I was not sure what to take as block type. The page/html/head.phtml right now only contains 1 line of html:

<meta name="viewport" content="width=device-width, initial-scale=1">

But right now the output of <?php echo $this->getChildHtml('head') ?> is empty.

What did I wrong? How can I include this block as a "sub-block" of head ?

1 Answer 1


The problem was that head.phtmlis allready in base and with that name I overwrited that template. All I needed to do was to take a name not taken yet for my head.phtml.

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.