2011-01-13 7 views
0

私のサイトの各ページコンテンツの上部にカルーセルと2つのバナーを表示します。 page.xmlのフッターブロックからカスタム参照を作成しました。 だから、これはどのように見えるかです:Magentoレイアウトでスタティックブロックの新しいリファレンスを提供する

<block type="page/html" name="topcontent" as="topcontent" template="page/html/topcontent.phtml"> 
    <block type="page/html_wrapper" name="topcontent.container" as="topcontentContainer" translate="label"> 
     <label>Page Top Content</label> 
     <action method="setElementClass"><value>topcontent-container</value></action> 
    </block> 
    <block type="core/template" name="topcontent.book.carousel" as="topcontentCarousel" template="callouts/book-carousel.phtml"/> 
    <block type="core/text_list" name="topcontent.left" as="topcontentLeft" /> 
    <block type="core/text_list" name="topcontent.right" as="topcontentRight" /> 
</block> 

それから私は私が私のカルーセルが正しく表示されていますが、私はブロックを置くしようとすると、

<div class="topcontent-container"> 
    <div class="topcontent"> 
     <?php echo $this->getChildHtml('topcontentContainer') ?> 
     <?php echo $this->getChildHtml('topcontentCarousel') ?> 
     <?php echo $this->getChildHtml('topcontentLeft') ?> 
     <?php echo $this->getChildHtml('topcontentRight') ?> 
    </div> 
</div> 

を置くtopcontent.phtmlファイルを作成上部コンテンツ左または上部コンテンツ右、それはすべて広告で表示されません。 私はブロック型のパラメータに何か間違っていると思いますが、私は何を理解できないのですか?おかげさまで

答えて

1

は、あなたがバナーに表示するために必要なものに依存します。それだけでいくつかのテキストだ場合は、テキストブロックを使用することができます。

<block type="core/text" name="topcontent.right" as="topcontentRight"> 
    <action method="addText"><text>Test text</text></action> 
</block> 

あなたには、いくつかのCMS静的ブロックコンテンツを表示するには、プレースホルダブロックが必要な場合は、その後、あなたは右、コート/ text_listは、このようなブロックのための適切なタイプですね。すべてのブロックがネストされ、1つずつレンダリングされます。だから次は、cms/blockプレースホルダを置くことです。コンテンツは後でバックエンドから追加できます。すべて一緒にそれはのように見えることがあります。

<block type="core/text_list" name="topcontent.right" as="topcontentRight"> 
    <block type="cms/block" name="topcontent.right.cms" as="topcontentRightCms"> 
     <action method="setBlockId"><block_id>topcontent_right_static</block_id></action> 
    </block> 
</block> 

は今、あなたは「topcontent_right_static」idを持つ管理者のバックエンドで新しい静的圏を作成することができ、それはそれあなたが出力場所でレンダリングされます。

+0

いいえ、必要なものを置くには地域が必要です。管理者が静的ブロックを公開するだけのバナーを置くことができるように、参照を作成したいと考えています。 – pasine

+0

答えが更新されました –

+0

私は同じ解決策がいくつかのモジュールのコードを見ていることを発見しました。ご協力いただきありがとうございます! – pasine

0

私は問題がtopcontentLeftとtopcontentRightため@type属性であると思い

type="core/text_list" need to be changed to type="core/template" 
+0

私はすでに試しましたが、問題は解決しませんでした。コア/テンプレートには、.phtmlテンプレートが必要です。 – pasine

+0

はい、テンプレートを使用する必要があります –

関連する問題