質問

フッターのTopLinksの下に表示する方法、

画像の入力ここにある

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

役に立ちましたか?

解決

古典的な学習 - テーマ - マゼントの質問!

別のブロックとの関係はテンプレートで最も明白です(あなたの現在の努力が示されているので)。親(フッター内のフッター内の)が別のブロックのレンダリングをトリガーする能力は、親子関係が確立される必要があります。これは通常、レイアウトアップデートXMLで発生します。

この関係がコアである場合は、ベース/デフォルトのテーマのレイアウト/ 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>
.

あなたの場合は、既存の2つのブロック間に関係を追加しているので、 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>
.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top