【问题标题】:Change homepage to 1column.phtml in local.xml in new theme in Magento在 Magento 的新主题中将主页更改为 local.xml 中的 1column.phtml
【发布时间】:2013-06-27 03:52:31
【问题描述】:

我是 Magento 的新手。我想在其中开发主题。我开始通过创建 CSS、JavaScript 来创建它并将这些文件添加到它并且它工作。我想将主页的模板文件更改为位于

中的 1column.phtml
my_theme/default/template/page/1column.phtml

这是我在 local.xml 文件中的代码

<?xml version="1.0" encoding="UTF-8"?>
<layout>
<!--default layout-->
<default>

    <reference name="head">
        <action method="addItem"><type>skin_css</type><name>css/style.css</name></action>
    </reference>

</default>  

<cms_index_index>

    <reference name="root">
        <action method="setTemplate"><template>page/1column.phtml</template></action>
    </reference>

    <reference name="head">
        <action method="addItem"><type>skin_js</type><name>js/script.js</name></action>
    </reference>        

 </cms_index_index>

</layout>

但结果默认使用 3column.phtml。

如何将 1column.phtml 设置为我的 Magento 主页?

【问题讨论】:

    标签: magento themes


    【解决方案1】:

    您可以简单地做到这一点,而无需更改任何核心文件:

    1. 登录管理面板
    2. 导航到 CMS->页面
    3. 转到名为“主页”的页面,单击它。
    4. 在左侧面板上转到“设计”选项卡
    5. 在“页面布局”列下,选择 1 列
    6. 保存

    请查看以下图片了解更多信息:

    【讨论】:

      【解决方案2】:

      当您编辑任何想要刷新缓存的 xml 文件时。这可以通过登录管理员并单击系统>缓存管理,然后全选,然后选择刷新来完成。

      或者,您可以在项目开发过程中禁用所有这些缓存。同一个地方,只是选择了不同的选项。


      编辑

      如果你忽略layout.xml,而是去magento admin到CMS>CMS页面选择主页cms页面,然后进入设计选项卡并输入以下内容

      <reference name="root">
          <action method="setTemplate"><template>page/1column.phtml</template></action>
          <remove name="left" />
          <remove name="right" />
      </reference>
      
      <reference name="head">
          <action method="addItem"><type>skin_js</type><name>js/script.js</name></action>
      </reference>
      

      【讨论】:

      • 我已经禁用了所有缓存。它不是来自缓存,因为除了 cms_index_index->​​reference->name=root 之外,local.xml 中的所有内容都已完成
      • 啊,好的,我稍微摆弄一下然后回来。
      猜你喜欢
      • 2013-10-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-12-28
      • 1970-01-01
      • 2017-04-12
      • 1970-01-01
      相关资源
      最近更新 更多