如何将Magento top.links复制到页眉和页脚中

时间:2013-10-04 03:19:24

标签: magento

我是Magento主题的新手,我正在尝试做一些基本的主题更改。

我想在标题和页脚中显示相同的top.links菜单。

我在page.xml中将块添加到页脚:

<block type="page/html_footer" name="footer" as="footer" template="page/html/footer.phtml">
<block type="page/template_links" name="top.links" as="topLinks"/>

并将此代码添加到footer.phtml

<?php echo $this->getChildHtml('topLinks') ?>

执行此操作后,菜单会显示在页脚中,但不再显示在页眉中。我猜一个块只能显示一次?如何在页眉和页脚上显示它?

谢谢。

2 个答案:

答案 0 :(得分:0)

在你的布局page.xml文件中:

        <block type="page/html_footer" name="footer" as="footer" template="page/html/footer.phtml">
            <block type="page/template_links" name="footer.links" as="footerLinks">
                //you need to add the links you wanna show here, for example:
                <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>
                //search for 'addLink' in the layout xml files to find all the links you want
            </block>
            ...//rest of footer's content
        </block>

并在你的footer.phtml中:

<?php echo $this->getChildHtml('footerLinks') ?>

答案 1 :(得分:-1)

我认为您不需要在xml中复制块,如果您只是在页脚文件中复制代码它将起作用