Magento – Disable caching of header.phtml for one template

blockscachemagento-1.9

I'm trying to stop my header from being cached on my onestepcheckout page so we can remove large amounts of content and streamline the checkout. I've added a check to see if the current page is the checkout, if not it will output the content.

This all works fine, until I enable the cache. I've tried changing my checkout.phtml to echo $this->getChildHtml('header', false); but this did not work.

I've also tried to disable the headers cache in my local.xml file, but this again has not worked.

<reference name="header">
   <action method="unsetData"><key>cache_lifetime</key></action>
   <action method="unsetData"><key>cache_tags</key></action>
   ...

I'm not sure what I'm doing wrong, these seem to be the 2 methods that I've seen online for this and can't find anything that specifically refers to the header, and a lot talk about having to make custom modules to output the template content, I am sure there must be a simpler solution.

I'm running Magento 1.9.

Best Answer

cache_lifetime must be set to null to disable cache for this block

<reference name="header">
    <action method="setCacheLifetime">
        <s>null</s>
    </action>
</reference>