Php 如何通过Magento的page.xml调用页脚中的toplinks
我是Magento的新手,我将带着一位在CMS配置/设计方面有丰富经验的web设计师来这里。所以所有的xml布局对我来说都是陌生的。我只想添加我的帐户、登录/注销以及我的购物车链接到页脚 Magento论坛帖子描述了要使用的代码以及要从中复制和粘贴到的文件,但就我的一生而言,我无法确切地知道应该在page.xml中的什么位置放置各种addLink xml代码,以使其显示在我的页脚中 以下是customer.XML中“我的帐户”和“登录/注销”链接的XML:Php 如何通过Magento的page.xml调用页脚中的toplinks,php,xml,magento,Php,Xml,Magento,我是Magento的新手,我将带着一位在CMS配置/设计方面有丰富经验的web设计师来这里。所以所有的xml布局对我来说都是陌生的。我只想添加我的帐户、登录/注销以及我的购物车链接到页脚 Magento论坛帖子描述了要使用的代码以及要从中复制和粘贴到的文件,但就我的一生而言,我无法确切地知道应该在page.xml中的什么位置放置各种addLink xml代码,以使其显示在我的页脚中 以下是customer.XML中“我的帐户”和“登录/注销”链接的XML: <!-- Default lay
<!--
Default layout, loads most of the pages
-->
<default>
<!-- Mage_Customer -->
<reference name="top.links">
<action method="addLink" translate="label title" module="customer"><label>My Account</label><url helper="customer/getAccountUrl"/><title>My Account</title><prepare/><urlParams/><position>10</position></action>
</reference>
</default>
<!--
Load this update on every page when customer is logged in
-->
<customer_logged_in>
<reference name="top.links">
<action method="addLink" translate="label title" module="customer"><label>Log Out</label><url helper="customer/getLogoutUrl"/><title>Log Out</title><prepare/><urlParams/><position>100</position></action>
</reference>
</customer_logged_in>
<!--
Load this update on every page when customer is logged out
-->
<customer_logged_out>
<!---<reference name="right">
<block type="customer/form_login" name="customer_form_mini_login" before="-" template="customer/form/mini.login.phtml"/>
</reference>-->
<reference name="top.links">
<action method="addLink" translate="label title" module="customer"><label>Log In</label><url helper="customer/getLoginUrl"/><title>Log In</title><prepare/><urlParams/><position>100</position></action>
</reference>
<remove name="reorder"></remove>
</customer_logged_out>
这里是page.XML中的XML,论坛帖子说它应该放在那里,我不确定它应该放在哪一行:
<block type="page/html_footer" name="footer" as="footer" template="page/html/footer.phtml">
<block type="page/html_wrapper" name="bottom.container" as="bottomContainer" translate="label">
<label>Page Footer</label>
<action method="setElementClass"><value>bottom-container</value></action>
</block>
<block type="page/switch" name="store_language" as="store_language" template="page/switch/languages.phtml"/>
<block type="page/switch" name="store_switcher" as="store_switcher" template="page/switch/stores.phtml"/>
<block type="page/template_links" name="footer_links" as="footer_links" template="page/template/links.phtml"/>
</block>
下面是footer.phtml中的标记,链接应该在这里结束:
<div class="four columns">
<?php echo $this->getChildHtml() ?>
</div>
我也很难理解getChildHtml是如何获取页脚链接的,它知道从哪里获取这些链接
任何帮助都将不胜感激!当我对Magento的强大感到兴奋时,我突然想到如何花上几个小时完成一项看似简单的任务,比如添加页脚链接。Brandon,请尝试页脚中的以下代码
<?php echo $this->getChildHtml("footer_links") ?>
尝试以下步骤
默认情况下,magento使用默认主题,我假设您正在使用此主题。我建议不要更改page.xml或magento的任何xml文件。
1.在app/design/frontend/default/default/layout中创建local.xml
2.将以下代码添加到local.xml文件
<?xml version="1.0"?>
<layout version="0.1.0">
<default>
<reference name="footer_links">
// This code it to remove the site map, search terms, advanced search, order and returns. Remove the below 4 lines if you want these in the footer.
<action method="removeLinkByUrl"><url helper="catalog/map/getCategoryUrl" /></action>
<action method="removeLinkByUrl"><url helper="catalogsearch/getSearchTermUrl" /></action>
<action method="removeLinkByUrl"><url helper="catalogsearch/getAdvancedSearchUrl" /></action>
<remove name="return_link" />
// to add my account link to footer links
<action method="addLink" translate="label title" module="customer"><label>My Account</label><url helper="customer/getAccountUrl"/><title>My Account</title><prepare/><urlParams/><position>10</position></action>
// to add cart link
<block type="checkout/links" name="checkout_cart_link">
<action method="addCartLink"></action>
</block>
</reference>
</default>
<customer_logged_in>
<reference name="footer_links">
<action method="addLink" translate="label title" module="customer"><label>Log Out</label><url helper="customer/getLogoutUrl"/><title>Log Out</title><prepare/><urlParams/><position>20</position></action>
</reference>
</customer_logged_in>
<customer_logged_out>
<reference name="footer_links">
<action method="addLink" translate="label title" module="customer"><label>Log In</label><url helper="customer/getLoginUrl"/><title>Log In</title><prepare/><urlParams/><position>20</position></action>
</reference>
<remove name="reorder"></remove>
</customer_logged_out>
</layout>
3.要删除联系人,请转到管理面板系统>配置>常规>联系人,并将启用联系人设置为否
4.要删除foorter中的关于我们、客户服务和隐私政策,转到管理面板CMS>静态块禁用带有标题页脚链接的块
现在您应该在页脚中获得链接。
如果仍然没有得到链接,请按照Amit Bera的建议在footer.phtml文件中调用此链接
注意:如果您使用的是自定义主题,请在app/design/frontend/your_-package/your_-theme/layout中创建local.xml文件