Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/magento/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在magento中显示页脚的顶部链接?_Magento_Toplink - Fatal编程技术网

如何在magento中显示页脚的顶部链接?

如何在magento中显示页脚的顶部链接?,magento,toplink,Magento,Toplink,如何在页脚的顶部链接下方显示 我在Footer.phtml文件中使用了以下代码 <?php echo $this->getChildHtml('topLinks'); ?> 但是链接不显示?。我该怎么做 提前谢谢 footer.phtml <div class="footer-container"> <div class="footer"> <?php echo $this->getChildHtml() ?

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

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

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

但是链接不显示?。我该怎么做

提前谢谢

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>

-


经典学习主题Magento问题

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

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


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

<?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>

顶部链接
顶部链接

对不起,我忘了提。我需要显示在页眉和页脚。现在链接在页脚中显示两次。我在上面贴了页脚编码啊,我忘记了空的
getChildHtml()
调用-它会回显每个子块。您可以省去自定义布局更新XML,只使用
getBlockHtml('top.links')
而不是
getChildHtml('top.links')
。这将按布局对象的名称从布局对象中拉出链接块。
<?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>