[英]Set template does not work for homepage
我很難聲明magento主頁將使用哪個模板。
不幸的是,這個項目不是由我啟動的,我只是提供連續性,而我對magento的了解非常淺。
在模板文件夾中,您擁有帶有與布局相關的XML的“布局”文件夾。
在此文件夾中,“常規” 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了,我試圖理解為什么它不起作用。
有兩種添加頁面的方法:
1)轉到CMS->頁面 ,然后在屏幕上添加代碼
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-> Pages,然后選擇此頁面,如屏幕截圖所示。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.