I tried excluding page/html/header.phtml from caching with Lesti FPC, but failed so far. How can I exclude that template file?

Magento 1.9.3

1 Answer 1


Always read the documentation first

You cannot exclude a specific phtml file from the cache. What you can do is exclude a layout block by it's name.

Once you have the name of the layout you can set it as a lazy or dynamic blocks. More on that here

The documentation also includes a handy little post for getting the name of your block in Magento source

here's what you need to do:

  1. Open up your header.phtml
  2. add in the following <?php echo $this->getNameInLayout(); ?>
  3. Load the frontend of your website
  4. you shoudld get something like header
  5. That's the name of your block! copy it and paste it in the settings for dynamic blocks
  • That works pretty good, I have the cart qty in the "header" block and this is updated now. Problem is, there is another block named "catalog.topnav.menu" called with $this->getChildHtml('topMenu') in header.phtml which shows the page menu. Whenever I put that to the dynamic blocks and enable the FPC, the menu is crashed. Any idea what might be wrong?
    – Arnie
    Nov 7, 2018 at 22:08
  • why do you need to add that to the dynamic blocks?
    – Haim
    Nov 7, 2018 at 22:37
  • Because when I add "header" to the dynamic blocks in order to have the cart qty count updated properly, the menu is messed up for some reason (the menu is part of "header"). So I tried to solve it by adding "catalog.topnav.menu" as well.
    – Arnie
    Nov 8, 2018 at 7:02
  • So then why don't you just add the cart block - not the entire header
    – Haim
    Nov 8, 2018 at 12:55
  • Because the cart code is in header.phtml and that blocks name is "header".
    – Arnie
    Nov 8, 2018 at 21:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.