我很难宣布magento主页将使用哪个模板。
不幸的是,这个项目并非由我开始,我只是提供连续性,而且我对magento的了解非常浅。
在模板文件夹中,您有“Layout”文件夹,其中包含与布局相关的XML。
在此文件夹中,“general”xml名为local.xml
<cms_index_index>
<reference name="root">
<action method="setTemplate"><template>page/homepage.phtml</template></action>
</reference>
<!-- Right column ====================================================================== -->
<reference name="left">
<!-- Disable left sidebar blocks on home page -->
<action ifconfig="mtquartz/sidebar_blocks_home/compare" method="unsetChild"><name>catalog.compare.sidebar</name></action>
<action ifconfig="mtquartz/sidebar_blocks_home/compared" method="unsetChild"><name>right.reports.product.compared</name></action>
<action ifconfig="mtquartz/sidebar_blocks_home/viewed" method="unsetChild"><name>left.reports.product.viewed</name></action>
<action ifconfig="mtquartz/sidebar_blocks_home/wishlist" method="unsetChild"><name>wishlist</name></action>
<action ifconfig="mtquartz/sidebar_blocks_home/poll" method="unsetChild"><name>right.poll</name></action>
<action ifconfig="mtquartz/sidebar_blocks_home/tags" method="unsetChild"><name>tags_popular</name></action>
<action ifconfig="mtquartz/sidebar_blocks_home/paypal" method="unsetChild"><name>paypal.partner.right.logo</name></action>
<remove name="left.reports.product.viewed" />
</reference>
<!-- Left column ====================================================================== -->
<reference name="right">
<!-- Disable right sidebar blocks on home page -->
<action ifconfig="mtquartz/sidebar_blocks_home/paypal" method="unsetChild"><name>paypal.partner.right.logo</name></action>
</reference>
</cms_index_index>
由于某种原因,cms_index_index的这个条件没有生效,它不会搜索homepage.phtml,但总是搜索1column.phtml。
这段代码已经是XML格式了,我试图理解为什么它不起作用。
答案 0 :(得分:1)
有两种方法可以添加页面:
1)转到 CMS - &gt;页面,并在屏幕上显示代码
2)或通过模块添加
按路径 app \ etc \ modules \ Homepages_PageLayouts.xml
创建档案<config>
<modules>
<Homepages_PageLayouts>
<codePool>local</codePool>
<active>true</active>
</Homepages_PageLayouts>
</modules>
</config>
Создатьпапкиифайлпотакомпутиapp\ code \ local \ Homepages \ PageLayouts \ etc \ config.xml
<?xml version="1.0"?>
<config>
<global>
<page>
<layouts>
<homepage_page_new>
<label>Home 4</label>
<template>page/homepage.phtml</template>
</homepage_page_new>
</layouts>
</page>
</global>
</config>
转到 CMS - &gt;页面并选择此页面,如屏幕截图所示。