获取Magento xml中的基本URL

时间:2012-07-31 19:33:52

标签: magento

我正在尝试通过footer_menu添加page.xml块的链接:

            <block type="page/template_links" name="footer_links" as="footer_links" template="page/template/links-follow.phtml">
                <action method="addLink" translate="label title">
                    <label>Condiciones generales</label>
                    <url>legal</url>
                    <title>Condiciones generales</title>
                </action>
            </block>

但是,显然路径是相对于它显示的页面。由于主网址必然会发生变化(从/foo/变为位于根/中),我想在商店基础网址前加上它以使其自动运行。

2 个答案:

答案 0 :(得分:3)

我发现在混音中添加<urlParams helper="core/url/getHomeUrl" />可以完成这项工作。 遵循元素的顺序是至关重要的,因为它可以使用(如果你问我,会很混乱)。

            <block type="page/template_links" name="footer_links" as="footer_links" template="page/template/links-follow.phtml">
                <action method="addLink" translate="label title">
                    <label>Condiciones generales</label>
                    <url>legal</url>
                    <title>Condiciones generales</title>
                    <urlParams helper="core/url/getHomeUrl" />
                </action>
            </block>

希望这会有所帮助。

答案 1 :(得分:1)

此方法正常工作

我正在使用{{baseUrl}}获取布局.xml文件中的基本URL,以便在客户/帐户/登录URL中添加规范URL

<reference name="head">
    <action method="addLinkRel">
        <rel>canonical</rel>
        <href>{{baseUrl}}customer/account/login</href>
    </action>
</reference>
相关问题