1

This is the general layout for all pages. In page.xml, there is this code

<default translate="label" module="page">
  <label>All Pages</label>
    <block type="page/html" name="root" output="toHtml" template="page/1column.phtml">
      <block type="page/html_head" name="head" as="head">
        <action method="addCss"><stylesheet>css/styles.css</stylesheet></action>

Now in page/1column.phtml, there is this code

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->getLang() ?>" lang="<?php echo $this->getLang() ?>">
<head>
<?php echo $this->getChildHtml('head') ?>
</head>

So I'm pretty sure <?php echo $this->getChildHtml('head') ?> starts including the contents of head block in page.xml, e.g. css/styles.css. Somehow in the view source, there is all the content in head.phtml between <head> and css/styles.css, but I have no idea what is putting it there. I don't see anything setting head.phtml in this layout file or local.xml. Does anyone know where this template is included in code? I think finding this will help me uncover a bug I'm experiencing..

1 Answer 1

3

Here the template file is not set through xml, rather it is defined in block. at location

app/code/core/mage/page/html/head.php 

you will see this code

protected function _construct()
{
    $this->setTemplate('page/html/head.phtml');
    $this->setData('is_enterprise', Mage::getEdition() == Mage::EDITION_ENTERPRISE);
}

this piece of code is responsible for setting head.phtml template

1
  • Ah yeah, and that's set by <block type="page/html_head". Thank you. Jul 14, 2014 at 16:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.