Magento重新排列块不工作

Magento重新排列块不工作,magento,block,Magento,Block,我想更改一些块的顺序和位置。从标题到右侧的位置已从更改,但顺序块不起作用 这是我的密码: <reference name="header"> <action method="unsetChild"><name>top.menu</name></action> <action method="unsetChild"><name>top.search</name></action&g

我想更改一些块的顺序和位置。从标题到右侧的位置已从更改,但顺序块不起作用

这是我的密码:

<reference name="header">
    <action method="unsetChild"><name>top.menu</name></action>
    <action method="unsetChild"><name>top.search</name></action>
    <action method="unsetChild"><name>top.links</name></action>
</reference>

<reference name="right">
    <remove name="right.poll" />

    <action method="insert">
        <blockName>top.menu</blockName>
    </action>

    <action method="insert">
        <blockName>top.search</blockName>
    </action>

    <action method="insert">
        <blockName>top.links</blockName>
        <after>top.menu</after> <!-- Here I want top.links to come after top.menuwhich is not working --> 
    </action>
</reference>

顶级菜单
top.search
顶部链接
顶级菜单
top.search
顶部链接
顶级菜单
这里,
是一个布尔值,不能在其中写入块名

<action method="insert">
        <blockName>top.links</blockName>
        <after>top.menu</after> <!-- Here I want top.links to come after top.menuwhich is not working --> 
</action>

顶部链接
顶级菜单
请尝试以下方法:

<action method="insert">
        <blockName>top.links</blockName>
        <sublingName>top.menu</sublingName>
        <after>1</after>
</action>

顶部链接
顶级菜单
1.

另一个选择是从干净的基础开始

  • 移除块
  • 重新创造它们
  • 这是我个人比较喜欢的,因为完整的布局更新都在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>
    
    
    导航栏
    我的帐户我的帐户
    愿望列表链接
    注销注销注销100
    在100中记录日志
    
    放置与顺序是什么意思?@jjm,放置意味着将位置从
    标题
    更改为
    右侧
    ,这是有效的。但是我想要的块的顺序是
    top.links
    之后
    top.menu
    不起作用这里是Ivan的一个很好的答案,它涵盖了你要找的@mrN对不起,你所说的快捷方式是什么?我的意思是