我已经尝试过各种教程,但是我无法得到它的工作。Magento:为不同的页面布局使用不同的页脚
基本上,我想在我的主页上拥有不同的页脚。我设置了两个页面布局,并将它们应用于cms页面。
所以在网页布局我指的是...
<?php echo $this->getChildHtml('footer_home') ?>
,并在所有其他网页此...
<?php echo $this->getChildHtml('footer_alt') ?>
很简单! 然后在页面的XML我已经修改它指的是页脚如下部分...
<block type="page/html_footer" name="footer_alt" as="footer_alt" template="page/html/footer_alt.phtml">
<block type="page/html_wrapper" name="bottom.container" as="bottomContainer" translate="label">
<label>Page Footer</label>
<action method="setElementClass"><value>bottom-container</value></action>
</block>
<block type="page/switch" name="store_switcher" as="store_switcher" template="page/switch/stores.phtml"/>
<block type="page/template_links" name="footer_links" as="footer_links" template="page/template/links.phtml"/>
</block>
<block type="page/html_footer" name="footer_home" as="footer_home" template="page/html/footer_home.phtml">
<block type="page/html_wrapper" name="bottom.container" as="bottomContainer" translate="label">
<label>Page Footer2</label>
<action method="setElementClass"><value>bottom-container</value></action>
</block>
<block type="page/switch" name="store_switcher" as="store_switcher" template="page/switch/stores.phtml"/>
<block type="page/template_links" name="footer_links" as="footer_links" template="page/template/links.phtml"/>
</block>
我想这就是问题所在。以上所有页面都显示'footer_alt'页脚,我不知道为什么。
我可以确认'page/html/footer_alt.phtml'和'page/html/footer_home.phtml'设置正确。
我希望这是有道理的。谢谢。
你有没有试过把渲染调用包装到getChildHtml中,在某种特殊的独特的字符?像'### <?php echo $ this-> getChildHtml('footer_home')?> ###'?根据上面的信息,渲染'footer_html'的调用似乎不太可能渲染'footer_alt' - 您可能正在编辑错误的文件。 –
我正在编辑的文件是主布局模板文件,page.xml文件以及后续的footer_alt.phtml和footer_home.phtml。 – user2689138