I am using the Optimiseweb Cookie Notice module: http://www.magentocommerce.com/magento-connect/cookie-law-compliance-eu-uk-implied-consent-16757.html
I would need to disable the cache for the .phtml template. Here is the XML that takes care of loading the template file (as far as I understood):
<layout version="0.1.0">
<default>
<reference name="head">
<action method="addCss" ifconfig="optimisewebcookienotice/general/enabled">
<stylesheet>css/cookienotice.css</stylesheet>
</action>
</reference>
<reference name="before_body_end">
<block type="cookienotice/notice" name="optimiseweb_cookienotice" as="OptimisewebCookienotice" template="optimiseweb/cookienotice/cookienotice.phtml" />
</reference>
</default>
</layout>
Edit: After the below comments, here is what I have now:
<layout version="0.1.0">
<default>
<reference name="optimiseweb_cookienotice">
<action method="setCacheLifetime">
<s>null</s>
</action>
</reference>
<reference name="head">
<action method="addCss" ifconfig="optimisewebcookienotice/general/enabled">
<stylesheet>css/cookienotice.css</stylesheet>
</action>
</reference>
<reference name="before_body_end">
<block type="cookienotice/notice" name="optimiseweb_cookienotice" as="OptimisewebCookienotice" template="optimiseweb/cookienotice/cookienotice.phtml" />
</reference>
</default>
</layout>
Is there a way that I can force the template to be not cached?
I have tried to change the cache lifetime in the block contruct function like below but that did not work:
protected function _construct() {
$this->addData(array(
'cache_lifetime' => null
));
}
Thanks in advance for any help on this!
Best Answer
you can use with xml like
You can use it
or
to set it to null.
or if you are using it by getChild then also pass as argument
You can disable cache in
getChildHtml().
This is what the signature looks like:This should do the trick: