이것이 홈페이지에서만 Before_Body_end에 사용자 정의 블록을 추가하는 올바른 방법입니까?
-
29-09-2020 - |
문제
Magento CE 1.9.1.0으로 작동합니다
여기에 배치 한 사용자 정의 코드를 작성했습니다.
app/design/frontend/mypackage/mytheme/template/page/html/custom_code.phtml
.
이 파일에 대한 새로운 XML 참조가 여기에 있습니다.
app/design/frontend/mypackage/mytheme/layout/page.xml
.
레이아웃 블록 내에 추가 된 참조입니다.
<cms_index_index>
<reference name="before_body_end">
<block type="core/template" name="my_custom_code" template="template/page/html/custom_code.phtml" />
</reference>
</cms_index_index>
.
그러나 캐시를 제거하고 시스템의 어느 곳에서나 오류가 없는지 확인한 후에는 홈페이지의 어느 곳에서나 before_body_end를 표시하도록 블록을 가져올 수 없습니다.내가 뭘 잘못하고 있니?
해결책
템플릿 위치가 잘못되었습니다.
템플릿이 App / Design / Frontend / your_pakage / your_theme / template / page / html / custom_code.phtml 에 있습니다.
magento, 낙하 로직 앱 / 디자인 / 프론트 엔드 / your_pakage / your_theme / template / 에 자동으로 표시됩니다.
page/html/custom_code.phtml
대신 template/page/html/custom_code.phtml
를 추가해야합니다.
template="page/html/custom_code.phtml"
template="template/page/html/custom_code.phtml"
을 사용하십시오 제휴하지 않습니다 magento.stackexchange