增加一个Custom CMS layout template


1.找到和打开Mage_All.xml文件在 app\etc\modules\
2.在41行。你将看到一个代码块像这样
    <Mage_Page>
        <active>true</active>
        <codePool>core</codePool>
        <depends>
            <Mage_Core/>
        </depends>
    </Mage_Page>
    替换为:
    <Mage_Page>
        <active>true</active>
        <codePool>local</codePool>
        <depends>
          <Mage_Core />
        </depends>
    </Mage_Page>


3.创建一个本地的config.xml文件
    你将注意到在 app/code里面有三个文件夹.
    community  这个是安装扩展从第三方扩展
    core       这个Magento 核心代码放置的地方。在这不要修改任何代码
    local      这个是你的文件夹,放置modules,extensions等等
    
4.创建新的目录app\code\local\Mage\Page\etc
5.复制app\code\core\Mage\Page\etc\中的config.xml到上面提到的目录中
6.在app\code\local\Mage\Page\etc中打开config.xml文件,找到three_columns在其后面增加
<!-- 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 -->

7.创建一个模板文件 packt.phtml在 app\design\frontend\base\default\template目录下

<!-- new layout for packt -->
<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>

8.登录到后面CMS|Page 新增或编辑页面 Design的Layout能看到packt

posted @ 2011-11-30 18:14  jack_段  阅读(139)  评论(0)    收藏  举报