Some websites use a separate footer containing extra information (usually for SEO purposes) on their front page. This is usually done by determining if the current page is the homepage in the footer template and then treating that footer differently. This dynamic logic makes the footer cache unfriendly, as LiteMage will punch a hole for the “footer” block as a public block. This means that whichever version of the footer, specialized or not, LiteMage encounters first will be the version that is served on every page.
For Example:
In the existing footer template “footer.phtml”, there is a PHP script that dynamically determines whether the current page is the home page.
<?php $page = Mage::app()->getFrontController()->getRequest()->getRouteName(); $isHomepage = false; if($page == 'cms'){ if('home' == Mage::getSingleton('cms/page')->getIdentifier()){ $isHomePage = true; } } if($isHomepage): ?> <div class="footer_bottom_text_container"> <div class="footer_bottom_text"> <?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('footer_bottom_text')->toHtml() ?> </div> </div> <?php endif; ?>
Solution: Have the homepage specially handled so that the “footer” hole will not be punched there and remove the dynamic portion of the footer block, allowing the public “footer” ESI block to continue being punched for other pages.
<div class="footer_bottom_text_container"> <div class="footer_bottom_text"> <?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('footer_bottom_text')->toHtml() ?> </div> </div>
<remove name="footer"/> <reference name="root"> <block type="page/html_footer" name="homefooter" as="footer" template="page/htm/homefooter.phtml"> ... </block> </reference>
This removes the old footer block and adds the newly created homefooter.phtml template for the home page.
Note: The block name used here has to be unique, but the alias must remain the same as to not interfere with any applied logic. Thus, it is very important to include name=“homefooter” as=“footer”.
Note: Blocks HTML output should remain disabled under System » Cache Management in the Magento Admin Panel.