Magento的布局文件一般在用的就4个,1column.phtml,2columns-left.phtml,2columns-right.phtml,3columns.phtml.今天magento互助群里有人问是不是可以弄4列的。那样就需要自己增加布局文件了。里面具体怎么布,就看你的需求了。我这里讲下如何增加magento布局文件。
一、新建一个布局文件newcolumn.phtml。
二、在layout\page.xml中标签里加以下代码,其中有其他布局文件的写法,可以仿照。
<page_new_columns translate=”label”>
<label>All new-Column Layout Pages</label>
<reference name=”root”>
<action method=”setTemplate”><template>page/newcolumn.phtml</template></action>
<!– Mark root page block that template is applied –>
<action method=”setIsHandle”><applied>1</applied></action>
</reference>
</page_new_columns>
三、在app\code\core\mage\page\etc\config.xml中47行这个标签里加入以下代码,同样有其他布局文件的写法,可参考
<new_columns module=”page” translate=”label”>
<label>new column</label>
<template>page/newcolumn.phtml</template>
<layout_handle>page_new_columns</layout_handle>
</new_columns>
这样就可以了,在Magento后台选择layout的时候 就会多一项new cloumn的选项。
评论