Magentoには、別のPHTMLファイル内のPHTMLファイルが含まれています
質問
Magento WebサイトのカスタムホームページをHOME_BANNER.PHTMLというPHTMLファイルで、次のコードでCMS-> Pages->ホームページの内容で参照しています。
{{block type="core/template" template="theme/home_banner.phtml"}}
.
my home_banner.phtmlでは、私はタグ/ mapulat.phtmlを呼び出して人気のタグを表示しました。
<div class="last-posts-grid clearfix">
<?php echo $this->getLayout()->createBlock('core/template')->setTemplate('tag/popular.phtml')->toHtml(); ?>
</div>
.
しかしながら、「すべてのタグを表示する」idが正しく呼ばれる「表示」の場合でも、タグは表示されません。UL CLASS="TAGS-LIST"はページソースに表示されますが、タグ自体が表示されていません。任意の提案?
解決
core/template
に変更ブロックタイプtag/popular
を必要とする必要があります。
<?php echo $this->getLayout()->createBlock('tag/popular')->setTemplate('tag/popular.phtml')->toHtml(); ?>
.
または
ブロック名を
{{block type="core/template" template="theme/home_banner.phtml" name="myname"}}
.
それから
XMLリファレンスを使用することによってタグ/ PAPOURD.PHTML
App / Design / Frontend / Youupackage / YouPackage / Layout
このコードを入れる
<?xml version="1.0"?>
<layout version="0.1.0">
<cms_index_index translate="label">
<reference name="myname">
<block type="tag/popular" name="home_tags_popular" template="tag/popular.phtml"/>
</reference>
</cms_index_index>
</layout>
.
home_banner.phtml でコードを下回る
.echo $this->getChildHtml('home_tags_popular');
所属していません magento.stackexchange