【发布时间】:2014-08-28 11:39:56
【问题描述】:
如何禁用缓存:
Mage::getSingleton('cms/page')->getIdentifier()
我需要为此禁用缓存,因为我只想在“主页”页面上显示一个静态块,例如:
<?php if (Mage::getSingleton('cms/page')->getIdentifier() == 'home' && Mage::app()->getFrontController()->getRequest()->getRouteName() == 'cms'): ?>
<div>
<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('shop-description-long')->toHtml() ?>
</div>
<?php endif; ?>
目前magento缓存了这个页面id,我可以在每个页面上看到这个块。
【问题讨论】:
-
你把静态块放在页脚吗?
-
您是否尝试过从系统缓存管理中禁用块缓存。
-
不,这个块不在页脚中,如果我禁用块缓存它工作得很好,但问题是页面 id 而不是块还是我错了?