2

As the title says I need to change the template path of the footer block for a specific CMS page. This is what I have in my page.xml:

<layout version="0.1.0">


    <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_footer" name="footer" as="footer" template="page/html/footer.phtml">
                <block type="page/html_wrapper" name="bottom.container" as="bottomContainer" translate="label">
                    <label>Page Footer</label>
                    <action method="setElementClass"><value>bottom-container</value></action>
                </block>
                <block type="newsletter/subscribe" name="newsletter" as="newsletter" template="newsletter/subscribe.phtml" />
            </block>

and this is what I put in the update layout XML box on the specific CMS page on the admin side:

<default>
    <reference name="root">
        <reference name="footer">
            <action method="setTemplate"><template>page/html/footer-shop.phtml</template></action>
        </reference>
   </reference> 
</default>

Footer keeps on showing footer.phtml template instead of footer-shop.phtml.

What is the correct way to change the footer template?

2

Here is the way to do it:

<reference name="footer">
    <action method="setTemplate"><template>page/html/footer-shop.phtml</template></action>
</reference>

In your code, you don't need to reference root, you only need to reference your footer block.

Also you don't need to specify the handle default as the CMS module will automatically match your specific CMS page handle with the Layout Update XML.

| improve this answer | |
  • I tried your code but I still displays the footer.phtml instead of footer-shop.phtml. The strange thing is that if I activate template hints, the footer is not recognized as separate block. – gianis6 Feb 29 '16 at 9:02
  • @gianis6 didn't notice you were dealing with the CMS update layout XML. See my edited answer – Raphael at Digital Pianism Feb 29 '16 at 9:03
0

You need to use below code in admin "Layout Update XML".

<reference name="footer">
            <action method="setTemplate"><template>page/html/footer-shop.phtml</template></action>
</reference>
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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