将主页更改为Magento中新主题的local.xml中的1column.phtml

时间:2013-06-27 03:52:32

标签: magento themes

我是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主页?

2 个答案:

答案 0 :(得分:4)

您只需在不更改任何核心文件的情况下执行此操作:

  1. 登录管理员面板
  2. 导航至CMS-&gt;页面
  3. 转到指定主页的页面,点击它。
  4. 在左侧面板上转到“设计”标签页
  5. 在页面布局列下,选择1列
  6. 保存
  7. 请查看以下图片以获取更多信息:

    enter image description here

答案 1 :(得分:1)

编辑要刷新缓存的任何xml文件时。这可以通过登录管理员并点击系统&gt;来完成。缓存管理,然后选择全部,然后选择刷新。

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


修改

如果忽略layout.xml而不是转到CMS的magento admin&gt; 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>