题
在CMS-> page-> design-> designxml中
我添加了:
<reference name="top.menu">
<action method="addLink" translate="label title" module="customer">
<label>Home</label>
<url></url>
<title>Home</title><prepare>true</prepare>
<urlParams/>
<position>5</position>
</action>
</reference>
这给出了一个错误(因为 name="top.menu"
)但是,顶部菜单的正确XML是什么(不是 顶部链接)
解决方案
尝试使用 top.links
代替 top.menu
在您的参考节点中。
<reference name="top.links">
<action method="addLink" translate="label title" module="customer">
<label>Home</label>
<url>/</url>
<title>Home</title><prepare>true</prepare>
<urlParams/>
<position>5</position>
</action>
</reference>
不可能简单地将链接添加到类别导航(top.menu
> catalog.topnav
).
您可以将子块添加到 top.menu
, ,因为它是 core/text_list
块,但它们将在 <div class="nav-container">
的 catalog.topnav
堵塞。
其他提示
您可以在内部创建一个块 top.menu
使用您的自定义链接。将其添加到您的主题中 local.xml
文件:
<reference name="header">
<reference name="top.menu">
<block type="page/template_links" name="top.menu.custom-links">
<action method="addLink" translate="label title">
<label>New Link</label>
<url>my-url</url>
<title>New Link</title>
<prepare>true</prepare>
<urlParams helper="core/url/getHomeUrl"/>
<position>60</position>
</action>
</block>
</reference>
</reference>
我认为这是最简单的方法。