我正在尝试做一些看起来应该很简单的事情:在每页的顶部链接上添加一个“主页”链接,除了主页(我正在使用cms页面作为我的主页)。如果可能,我想完全在我的local.xml中完成。如何通过Magento 1.5.1中的local.xml有条件地删除顶级主页链接
我的想法是添加链接默认
<default>
<reference name="top.links">
<action method="addLink" translate="label title">
<label>Home</label>
<url>/</url>
<title>Home</title>
<prepare>true</prepare>
<urlParams helper="core/url/getHomeUrl"/>
<position>1</position>
<liParams/>
<aParams>class="top-link-home"</aParams>
<beforeText></beforeText>
<afterText>/</afterText>
</action>
</reference>
</default>
,然后删除它cms_index_index
<cms_index_index>
<reference name="top.links">
<action method="removeLinkByUrl"><url helper="core/url/getHomeUrl"/></action>
</reference>
</cms_index_index>
但这并没有奏效,在主页的链接处处显示出来,包括主页。
我在做什么错?有没有另一种方法可以做到这一点,不涉及黑客攻击?
编辑: 我拼写出整个URL所期望的行为,无论是在我的addLink
<default>
<reference name="top.links">
<action method="addLink" translate="label title">
<label>Home</label>
<url>http://www.mysite.com/</url>
<title>Home</title>
<prepare/>
<urlParams/>
<position>1</position>
<liParams/>
<aParams>class="top-link-home"</aParams>
<beforeText></beforeText>
<afterText>/</afterText>
</action>
</reference>
</default>
和我removeLinkByUrl
<cms_index_index>
<reference name="top.links">
<action method="removeLinkByUrl"><url>http://www.mysite.com/</url></action>
</reference>
</cms_index_index>
解决了眼前的问题,但不回答我原来的问题。我想我需要更好地了解Magento如何使用助手呈现网址。
问题来自Magento添加SID参数。它没有被渲染,我不知道为什么它需要在这种情况下。我将在稍后讨论这个问题 – benmarks