我能够自定义链接添加到Magento的top.links用下面的代码,我保存../myCustomTheme/layout/local.xml如何添加链接到重定向到另一个域的Magento top.links?
<reference name="root">
<reference name="top.links">
<action method="addLink" translate="label title">
<label>example</label>
<url>example</url>
<title>example</title>
<prepare>true</prepare>
<urlParams helper="core/url/getHomeUrl"/>
<position>100</position>
<liParams/>
<aParams>class="top-link-example"</aParams>
<beforeText></beforeText>
<afterText></afterText>
</action>
</reference>
</reference>
上面的代码将创建一个名为例如该链接点到http://myexampledomain.com/example。如果我改变了一行代码
<url>example</url>
到
<url>http://myotherexampledomain.com</url>
我结束了一个链接名为例如指向http://myexampledomain.com/http:/myotherexampledomain.com。我已经尝试将prepare参数设置为false,并通过查看../app/code/core/Mage/Core/Model/Url.php来无效地向urlParams添加各种参数。
解决了我的问题。 值得注意的是,您必须提供addLink方法所需的所有参数,因为如果从列表中缺少一个参数,那么它之后的所有参数都将从XML中忽略。 – nyaray 2013-11-11 05:06:47