Set default Magento page layout to 3 columns
Is there a way to set all pages (catalog,product,cart,checkout,search) as having a 3-column layout in local.xml, instead of specifying layout for each block?
I tried the following code
<?xml version="1.0"?>
<layout version="0.1.0">
<default>
<reference name="root">
<action method=&开发者_如何学编程quot;setTemplate"><template>3columns.phtml</template></action>
</reference>
</default>
</layout>
It's not working; the log shows
2011-08-12T07:20:10+00:00 CRIT (2): Not valid template file:frontend\base\default\template\3columns.phtml
As far as your error message is concerned, you are trying to load a file that doesn't exist. The filename in the error message was a huge giveaway. The page layout files are in template/page/*.phtml
, not template/*.phtml
.
You need to change:
<action method="setTemplate"><template>3columns.phtml</template></action>
to..
<action method="setTemplate"><template>page/3columns.phtml</template></action>
You should override page.xml layout and change the root block template in the default handle.
Copy app/design/frontend/base/default/layout/page.xml to app/design/frontend/default/YOURTHEME/layout/page.xml
Do the appropriate changes there :
<default translate="label" module="page">
<label>All Pages</label>
<block type="page/html" name="root" output="toHtml" template="page/3columns.phtml">
<!-- ... -->
</block>
</default>
精彩评论