1.由于Magento的机制,我们需要在local代码库中创建配置文件,目的是保护core完整。找到app/etc/modules/Mage_All.xml,修改page的配置:
<Mage_Page> <active>true</active> <codePool>local</codePool> <depends> <Mage_Core /> </depends> </Mage_Page>
2.直接把app/code/core/Mage/Page/etc/config.xml复制到app/code/local/Mage/Page/etc/下,没有该目录的话就自己建
3.在3列的layout下面插入以下代码:
<!-- new layout for packt --> <packt module="page" translate="label"> <label>packt</label> <template>page/packt.phtml</template> <layout_handle>page_packt</layout_handle> </packt> <!-- new layout for packt -->
4.然后我们应该添加packt.phtml到base的模版文件中,app/design/frontend/base/ default/template/page/,可以像这样:
<!--- put your template code here ---> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http:// www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->getLang() ?>" lang="<?php echo $this->getLang() ?>"> <head> <?php echo $this->getChildHtml('head') ?> </head> <body<?php echo $this->getBodyClass()?' class="'.$this- >getBodyClass().'"':'' ?>> <?php echo $this->getChildHtml('after_body_start') ?> <div class="wrapper"> <?php echo $this->getChildHtml('global_notices') ?> <div class="page"> <?php echo $this->getChildHtml('header') ?> <div class="main-container col3-layout"> <div class="main"> <?php echo $this->getChildHtml('breadcrumbs') ?> <div class="col-wrapper"> <div class="col-main"> <?php echo $this->getChildHtml('global_messages') ?> <?php echo $this->getChildHtml('content') ?> </div> <div class="col-left sidebar"><?php echo $this- >getChildHtml('left') ?></div> </div> <div class="col-right sidebar"><?php echo $this- >getChildHtml('right') ?></div> </div> </div> <?php echo $this->getChildHtml('footer') ?> <?php echo $this->getChildHtml('before_body </div> </div> <?php echo $this->getAbsoluteFooter() ?> </body> </html>
5.最后刷新下,可以在后台的cms layout下拉列表下看到我们的新布局了!