0

我正在尝试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>

但是,显然路径是相对于它所显示的页面的。由于 home url 必然会改变(从 in/foo/到 root /),我想预先添加 shop base url 以使其自动工作。

4

2 回答 2

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>

希望这可以帮助。

于 2012-07-31T19:33:51.940 回答
3

这种方法工作正常

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

<reference name="head">
    <action method="addLinkRel">
        <rel>canonical</rel>
        <href>{{baseUrl}}customer/account/login</href>
    </action>
</reference>
于 2019-01-08T11:07:23.390 回答