So I’ve done some layouts that I want to use and I was thinking that setting this in your local.xml file would fix this for every page. Like this
<default>
<reference name="root">
<action method="setTemplate">
<template>page/mytheme.phtml</template>
</action>
</reference>
</default>
This however doesn’t do anything. Instead if I go
...<customer_account_forgotpassword>
<reference name="root">
<action method="setTemplate"><template>page/mytheme.phtml</template></action>
</reference>
</customer_account_forgotpassword>
<customer_account_confirmation>
<reference name="root">
<action method="setTemplate"><template>page/mytheme.phtml</template></action>
</reference>
</customer_account_confirmation>...
and so on for every specific place it gets changed on those specific pages. Am I thinking wrong or this the only way to do it?
The problem you’re (probably) running into is that something comes along later and sets the template for the root block again, overriding your change.
More recent versions of Magento (1.4somethingish) introduced a way to prevent this from happening. If you look in
page.xml, you’ll see a handle like thisIf the
page_one_columnhandle gets applied to your request, or you manually apply it withMagento will change the template and call the
setIsHandlemethod on the block.There’s code in Magento that will look for the IsHandle property, and if it’s true, further calls to
setTemplatewill be ignored. (that’s over-simplifying things a bit, but is more or less true)Try something like
And see if that helps.
Keep in mind this is one of those grey areas where it’s not clear if third party developers are supposed to tread. Also, changing the template for all pages may have un-desirable effect on parts of the site that expect to be in a certain template.