Magento는 다른 PHTML 파일에 PHTML 파일을 포함합니다
문제
home_banner.phtml이라는 phtml 파일에서 Magento 웹 사이트의 사용자 정의 홈 페이지를 작성하고 있습니다.이 코드는 다음 코드로 CMS-> 페이지 -> 홈 페이지 내용을 참조했습니다.
{{block type="core/template" template="theme/home_banner.phtml"}}
.
내 home_banner.phtml에서 i tags / foxed.phtml이라고 불 렸습니다. 인기있는 태그를 표시합니다.
<div class="last-posts-grid clearfix">
<?php echo $this->getLayout()->createBlock('core/template')->setTemplate('tag/popular.phtml')->toHtml(); ?>
</div>
.
"모든 태그보기"ID가 올바르게 호출되는 앵커 태그가 있더라도 태그가 표시되지 않습니다.UL 클래스="태그 목록"은 페이지 소스에도 표시되지만 태그 자체가 표시되지 않습니다.어떤 제안?
해결책
BLOCK TYPE 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 참조를 사용하여 태그 / 인기있는
앱 / Design / FrontEnd / Youupackage / yourtemplate / layout에서 local.xml 만들기
이 코드를 넣어
<?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