【问题标题】:How to add new layout via local.xml?如何通过 local.xml 添加新布局?
【发布时间】:2013-04-07 08:14:11
【问题描述】:

如何使用 local.xml 在 magento 中添加新布局?当我创建新的 CMS 页面时,我希望它出现在布局列表中。

【问题讨论】:

  • 我不能这样做。页面布局下拉菜单的值是从配置 XML 中读取的。

标签: magento layout content-management-system


【解决方案1】:

使用 local.xml 在 magento 中布局

请按照此代码进行操作。

http://www.codeboss.in/web-funda/2009/07/07/create-new-layout-in-magento/

【讨论】:

    【解决方案2】:

    查看this page 上的最后一段代码。您可以进入app/code/core/Mage/Page/etc/config.xml 并添加如下行:

     <TEMPLATE_LABEL module="page" translate="label">
         <label>TEMPLATE NAME</label>
         <template>page/TEMPLATE-FILENAME.phtml</template>
         <layout_handle>page_HANDLE_NAME</layout_handle>
     </TEMPLATE_LABEL>
    

    替换大写的单词,例如

     <home_format module="page" translate="label">
         <label>Home Format</label>
         <template>page/home-page.phtml</template>
         <layout_handle>page_home_format</layout_handle>
     </home_format>
    

    就在&lt;page&gt; ... &lt;/page&gt; 代码块的末尾。

    注意:如果你这样做,你可能无法在不丢失自定义布局的情况下升级 Magento,因为config.xml 是一个核心文件。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-02-25
      • 2014-07-18
      • 2015-10-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-10-11
      相关资源
      最近更新 更多