另一种选择是从一个干净的基础开始
- 移除方块
- 重新创建它们
这是我个人更喜欢的,因为完整的布局更新都在 local.xml 中,这样更易于阅读和理解以进行维护。这也可以避免块嵌套中的冲突,因为我的解决方案建议重命名它们(top.links => right.links,top.search => right.search,top.nav => right.nav)。但这只是我根据我的经验得出的看法:)
所以这是我在 Magento 1.7.0.1 上成功尝试过的 local.xml
<layout version="0.1.0">
<default>
<reference name="header">
<remove name="top.menu"/>
<remove name="top.search"/>
<remove name="top.links"/>
</reference>
<reference name="right">
<block type="core/text_list" name="right.menu" as="topMenu" translate="label" before="-">
<label>Navigation Bar</label>
<block type="page/html_topmenu" name="catalog.rightnav" template="page/html/topmenu.phtml"/>
</block>
<block type="page/template_links" name="right.links" as="rightLinks" after="right.menu">
<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>
<block type="wishlist/links" name="wishlist_link" />
<action method="addLinkBlock"><blockName>wishlist_link</blockName></action>
<block type="checkout/links" name="checkout_cart_link">
<action method="addCartLink"></action>
<action method="addCheckoutLink"></action>
</block>
</block>
<block type="core/template" name="right.search" as="rightSearch" template="catalogsearch/form.mini.phtml" after="right.links"/>
</reference>
</default>
<customer_logged_in>
<reference name="right.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>
<customer_logged_out>
<reference name="right.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>
</customer_logged_out>
</layout>