如何在magento的页脚显示顶部链接? [英] how to display toplinks at footer in magento?

查看:90
本文介绍了如何在magento的页脚显示顶部链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在页脚的顶部链接下方显示

How can i display below toplinks in footer,

我在Footer.phtml文件中使用了以下代码,

i used below code in Footer.phtml file,

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

但是不显示链接?.我该怎么办?

but the links are not displayed?. How can i do this?

预先感谢

footer.phtml

footer.phtml

<div class="footer-container">
    <div class="footer">
        <?php echo $this->getChildHtml() ?>
        <?php echo $this->getChildHtml('newsletter') ?>

        <?php //echo $this->getLayout()->createBlock('cms/block')->setBlockId('sample_links')->toHtml() ?>

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

    <?php echo $this->getChildHtml('top.links'); ?> 


        <p class="bugs"><?php echo $this->__('Help Us to Keep Magento Healthy') ?> - <a href="http://www.magentocommerce.com/bug-tracking" onclick="this.target='_blank'"><strong><?php echo $this->__('Report All Bugs') ?></strong></a> <?php echo $this->__('(ver. %s)', Mage::getVersion()) ?></p>
        <address><?php echo $this->getCopyright() ?></address>
    </div>
</div>
</div>

推荐答案

经典的以主题为主题的学习型问题!

Classic learning-to-theme-Magento question!

一个块与另一个块之间的关系在模板中最为明显(如您当前的工作所示).父级(在您的情况下为页脚)触发另一个块的渲染的能力要求建立父子关系.这通常发生在布局更新XML中.

The relationship of one block to another is most evident in templates (as your current effort demonstrates). The ability for a parent (footer, in your case) to trigger rendering of another block requires that a parent-child relationship be established. This typically happens in layout update XML.

如果这种关系是核心,那么您可能会在基本/默认主题的 layout/page.xml 文件中看到以下内容:

If this relationship were core, it is likely that you would see the following in the base/default theme's layout/page.xml file:

<block type="page/html_footer" name="footer" ...>
    <!-- other child block directives -->
    <block type="page/template_links" name="top.links" as="topLinks"/>
</block>

在您的情况下,由于要在两个现有块之间添加关系,因此可以在名为 local.xml 的特殊最终用户布局xml文件中设置块实例之间的关系,您应该放置在自定义主题的 layout 文件夹中.它应该是这样的:

In your case, because you are adding a relationship between two existing blocks, you can set up a relationship between block instances in a special end-user layout xml file named local.xml which you should place in your custom theme's layout folder. Here is what it should look like:

<?xml version="1.0"?>
<layout>
    <default><!-- effectively: "do this on all pages" --> 
        <reference name="footer"><!-- parent block -->
            <action method="insert"><!-- this PHP class method sets the relationship -->
                <block_name_to_insert>top.links</block_name_to_insert><!--use the block name in the layout, not the alias. See Mage_Core_Block_Abstract::insert() -->
                <sort_relative_to_other_childname/><!-- empty val is fine here -->
                <sort_before_or_after/><!-- not relevant -->
                <alias>topLinks</alias><!-- because you are using the original alias, need to re-specify that here -->
            </action>
        </reference>
    </default>
</layout>

这篇关于如何在magento的页脚显示顶部链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆