magento默认的有5中layout template方式,分别为:

empty

1columns

2columns-left

2columns-right

3columns

这么5中,有时候我们想自己做一个新的layout template

让我们的页面更加的灵活,方便

下面是实现的步骤:增加一个4columns 的layout template

 

  1. 复制 app/code/core/Mage/Page/etc/config.xml
      到app/code/local/Mage/Page/etc/config.xml.
    然后打开这个文件

             找到代码

  <page>
            <layouts>
                <empty module="page" translate="label">
                    <label>Empty</label>
                    <template>page/empty.phtml</template>
                    <layout_handle>page_empty</layout_handle>
                </empty>
                <one_column module="page" translate="label">
                    <label>1 column</label>
                    <template>page/1column.phtml</template>
                    <layout_handle>page_one_column</layout_handle>
                    <is_default>1</is_default>
                </one_column>
                <two_columns_left module="page" translate="label">
                    <label>2 columns with left bar</label>
                    <template>page/2columns-left.phtml</template>
                    <layout_handle>page_two_columns_left</layout_handle>
                </two_columns_left>
                <two_columns_right module="page" translate="label">
                    <label>2 columns with right bar</label>
                    <template>page/2columns-right.phtml</template>
                    <layout_handle>page_two_columns_right</layout_handle>
                </two_columns_right>
                <three_columns module="page" translate="label">
                    <label>3 columns</label>
                    <template>page/3columns.phtml</template>
                    <layout_handle>page_three_columns</layout_handle>
                </three_columns>
           
            </layouts>
        </page>

 

将其替换为:

  <page>
            <layouts>
                <empty module="page" translate="label">
                    <label>Empty</label>
                    <template>page/empty.phtml</template>
                    <layout_handle>page_empty</layout_handle>
                </empty>
                <one_column module="page" translate="label">
                    <label>1 column</label>
                    <template>page/1column.phtml</template>
                    <layout_handle>page_one_column</layout_handle>
                    <is_default>1</is_default>
                </one_column>
                <two_columns_left module="page" translate="label">
                    <label>2 columns with left bar</label>
                    <template>page/2columns-left.phtml</template>
                    <layout_handle>page_two_columns_left</layout_handle>
                </two_columns_left>
                <two_columns_right module="page" translate="label">
                    <label>2 columns with right bar</label>
                    <template>page/2columns-right.phtml</template>
                    <layout_handle>page_two_columns_right</layout_handle>
                </two_columns_right>
                <three_columns module="page" translate="label">
                    <label>3 columns</label>
                    <template>page/3columns.phtml</template>
                    <layout_handle>page_three_columns</layout_handle>
                </three_columns>
                <four_columns module="page" translate="label">
                <label>4 columns</label>
                <template>page/4columns.phtml</template>
                <layout_handle>page_four_columns</layout_handle>
                </four_columns>
            </layouts>
        </page>

2

在目录app/etc/modules中,新建文件  Mage_Local.xml

内容为:<?xml version="1.0"?>
<config>
<modules>
<Mage_Page>
<active>true</active>
<codePool>local</codePool>
<depends>
<Mage_Core/>
</depends>
</Mage_Page>
</modules>
</config>

 

3

打开目录:

app/design/frontend/your_package/your_theme/template/page

在这个文件里面新建一个文件4columns.phtml,然后随便复制一个文件,譬如:3columns.phtml,将其内容复制到4columns.phtml文件中(里面的内容,按照自己的定制改)

4

刷新缓存,就可以使用了