2

Below is a snippet from page.xml...

            <action method="addItem"><type>skin_js</type><name>js/slideshow.js</name></action>
            <action method="addItem"><type>skin_js</type><name>js/lib/imagesloaded.js</name></action>
            <action method="addLinkRel"><rel>stylesheet</rel><href>//fonts.googleapis.com/css?family=Raleway:300,400,500,700,600</href></action>
            <action method="addItem"><type>skin_js</type><name>js/minicart.js</name></action>

            <!-- Add stylesheets with no media queries for use in IE 8 and below -->
            <action method="addItem"><type>skin_css</type><name>css/styles-ie8.css</name><params/><if><![CDATA[ (lte IE 8) & (!IEMobile)]]></if></action>
            <action method="addItem"><type>skin_css</type><name>css/madisonisland-ie8.css</name><params/><if><![CDATA[ (lte IE 8) & (!IEMobile)]]></if></action>


<!-- #################################################################################-->


            <!-- Add stylesheets with media queries for use by modern browsers -->
            <action method="addItem"><type>skin_css</type><name>css/styles.css</name><params/><if><![CDATA[<!--[if (gte IE 9) | (IEMobile)]><!-->]]></if></action>
            <action method="addItem"><type>skin_css</type><name>css/madisonisland.css</name><params/><if><![CDATA[<!--[if (gte IE 9) | (IEMobile)]><!-->]]></if></action>

            <!-- Sets viewport meta tag using text block -->
            <block type="core/text" name="head.viewport">
                <action method="setText"><text><![CDATA[<meta name="viewport" content="initial-scale=1.0, width=device-width" />]]>&#10;</text></action>
            </block>

This is the default Magento 1.9 RWD page.xml.

Everything above the line of hashes ### is being loaded in the <head>.

Everything below the line of hashes ### is being loaded in the <body>.

Despite all these calls included within the same block, it is breaking somehow, half way through - the block starts with:-

<default translate="label" module="page">
    <label>All Pages</label>
    <block type="page/html" name="root" output="toHtml" template="page/3columns.phtml">

        <block type="page/html_head" name="head" as="head">

Rendered in the browser at the frontend at the very top of the page, but just inside the opening <body> is ]> which I believe does indicate there is possibly some sort of syntax error with one of the [CDATA references although I can't see an issue anywhere - it is exactly the same file as the 1.9 RWD Magento demo and that doesn't have the issue.

Two hours on trying to get to the bottom of this and I'm now beginning to pull my hair out.

Any ideas?

Edit

I thought it clear, but evidently not.

The line of hashes ### is not actually in the file. I just added this into my question to show you where the split occurs (i.e - everything above in the <head> and everything below in the <body>.

1
  • Hi, could you please try to disable the Block Cache and check if it still happens? For debugging it might also be useful to enable the Template path hints. alanstorm.com/find_magento_block_name
    – RobM84
    Commented Oct 27, 2014 at 7:29

2 Answers 2

1

I have managed to fix the GT Speed module that was causing the exact same issue for me.

Here is my fix:

To apply under app/code/community/GT/Speed/Block/Html/Head.php

Replace line 59-61:

if ( !empty( $if ) ) {
     $html .= '<!--[if ' . $if . ']>' . "\n";
}

By:

        if (!empty($if)) {
            // open !IE conditional using raw value
            if (strpos($if, "><!-->") !== false) {
                $html .= $if . "\n";
            } else {
                $html .= '<!--[if '.$if.']>' . "\n";
            }
        }

And then line 76-77:

        if ( !empty( $if ) ) {
            $html .= '<![endif]-->' . "\n";
        }

By:

        if (!empty($if)) {
            // close !IE conditional comments correctly
            if (strpos($if, "><!-->") !== false) {
                $html .= '<!--<![endif]-->' . "\n";
            } else {
                $html .= '<![endif]-->' . "\n";
            }
        }
1
  • Ah, I had actually fixed this myself some time ago now but forgot to post an answer on this question. Good work and thanks for contributing your fix. Will mark your answer as correct...
    – zigojacko
    Commented Jan 14, 2015 at 8:38
2

I have found the issue caused being something in the GT Speed extension which does extend Mage_Page_Block_Html_Head - disabling it for the moment has resolved.

I will debug further though and provide more to my answer as soon as I can.

Magento 1.9 doesn't use a head.phtml template file by default but one does work if added - possibly related, yet to confirm.

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.