1

I'm calling in a layout update from a module, from the module's config.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<config>

...

    <frontend>
        <layout>
            <updates>
                <cmsogdata>
                    <file>cjw/cmsogdata.xml</file>
                </cmsogdata>
            </updates>
        </layout>
    </frontend>

...

</config>

It pulls the file in fine - if I put a deliberate syntax error in cmsogdata.xml, everything breaks as you'd expect.

What I'm trying to do is add a custom block into the HTML <head> on every page via <default> and it's not working.

<?xml version="1.0" encoding="UTF-8"?>
<layout version="0.1.0">

    <default>
        <reference name="head">
            <block type="core/template" name="og.general" template="page/html/og-general.phtml" />
        </reference>
    </default>

</layout>


However if I target a specific page, such as the homepage it does work, e.g.:

<?xml version="1.0" encoding="UTF-8"?>
<layout version="0.1.0">

    <cms_index_index>
        <reference name="head">
            <block type="core/template" name="og.general" template="page/html/og-general.phtml" />
        </reference>
    </cms_index_index>

</layout>


What am I missing?

2
  • Strange.It should work. Commented Apr 13, 2017 at 9:43
  • @KingshukDeb That's what I feared :\
    – CD001
    Commented Apr 13, 2017 at 11:10

1 Answer 1

0

Found it; I'd forgotten that I was playing crazy with this development install so in local.xml I was stripping everything back and overwriting it - so:

<?xml version="1.0" encoding="UTF-8"?>
<layout version="0.1.0">

    <default translate="label" module="page">
        <label>All Pages</label>
        <block type="page/html" name="root" output="toHtml">

            <!-- [begin] html head -->
            <block type="page/html_head" name="head" as="head">

            ...

Which meant that local.xml was overwriting the module as well as Magento's own settings. Reverting it to the proper, sane, override system sorted it.

<?xml version="1.0" encoding="UTF-8"?>
<layout version="0.1.0">

    <!-- default -->
    <default>

        <!-- [begin] html head -->
        <reference name="head">

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.