XMLでのみTopMenuにCMSページを追加します
質問
in 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.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
, 、それはaだからです 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>
これが最も簡単な方法だと思います。
所属していません magento.stackexchange