Magento CE 1.7.0.2:某些方法仅在 footer.phtml 上启用缓存时不起作用

Magento CE 1.7.0.2: some methods do not work only when the cache is enabled on footer.phtml

Magento 缓存已启用:Mage::getBlockSingleton('page/html_header')->getIsHomePage() 等方法仅在 footer.phtml[=11= 启用缓存时才起作用]

不,他们不会,因为页脚的 phtml 将缓存为一个块。您应该在不会缓存的 page.xml 中嵌套块 - 例如 cart_sidebar ,或者如果您仅针对主页,则在管理员中转到主页 cms,转到布局更新并在那里添加块;

<reference name="footer">
<block type="your/block" name="yourblock" template="path/to/block.phtml" before="-"  />
</reference>