Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
litespeed_wiki:cache:litemage:troubleshooting:separate-front-page-footer [2016/09/26 18:32]
Rob Holda
litespeed_wiki:cache:litemage:troubleshooting:separate-front-page-footer [2017/05/08 20:05] (current)
Lisa Clarke
Line 1: Line 1:
 +~~NOTOC~~
 ====== Using A Separate Footer On Your Front Page ====== ====== Using A Separate Footer On Your Front Page ======
  
-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.+==== Problem ==== 
 +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 ​LiteMage encounters first, specialized or not, will be the version that is served on every page.
  
-**For Example:** +==== Example ​==== 
- +In the existing footer template ​''​footer.phtml''​, there is a PHP script that dynamically determines whether the current page is the home page.
-In the existing footer template ​"footer.phtml", there is a PHP script that dynamically determines whether the current page is the home page.+
  
   <?php   <?php
Line 23: Line 24:
   <?php endif; ?>   <?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. ​  +==== Solution ​==== 
- +Have the homepage specially handled so that the footer hole will not be punched there. Remove ​the dynamic portion of the footer block, allowing the public footer ESI block to continue being punched for other pages. ​  
-  - Copy the footer template to a new file as "homefooter.phtml". As this will only be used for the home page, there is no need to keep the added home page logic and the content can instead be added directly. \\ \\ <​code><​div class="​footer_bottom_text_container">​+Here's how: 
 +  - Copy the footer template to a new file as ''​homefooter.phtml''​. As this will only be used for the home page, there is no need to keep the added home page logic and the content can instead be added directly. \\ \\ <​code><​div class="​footer_bottom_text_container">​
        <​div class="​footer_bottom_text">​        <​div class="​footer_bottom_text">​
             <?php echo $this->​getLayout()->​createBlock('​cms/​block'​)->​setBlockId('​footer_bottom_text'​)->​toHtml() ?>             <?php echo $this->​getLayout()->​createBlock('​cms/​block'​)->​setBlockId('​footer_bottom_text'​)->​toHtml() ?>
        </​div>​        </​div>​
   </​div></​code>​   </​div></​code>​
-  - Update ​"footer.phtml" ​by removing the aforementioned logic as this file will now be used for non-home pages only. Removing this dynamic code will also have the positive side effect of improving footer render time.+  - Update ​''​footer.phtml'' ​by removing the aforementioned logic as this file will now be used for non-home pages only. Removing this dynamic code will also have the positive side effect of improving footer render time.
   - Identify the footer block section of the layout XML file currently in use. Copy the full footer block section, including all sub blocks used.   - Identify the footer block section of the layout XML file currently in use. Copy the full footer block section, including all sub blocks used.
-  - In the Magento Admin Panel, navigate to CMS >> Pages and click edit to edit the home page. +  - In the Magento Admin Panel, navigate to **CMS > Pages** and click ''​edit'' ​to edit the home page. 
-    - Navigate to Design ​>> Page Layout ​>> Layout Update XML+    - Navigate to **Design > Page Layout > Layout Update XML**
     - Add the copied footer block XML here with the following modification:​ \\ \\ <​code> ​    <​remove name="​footer"/>​     - Add the copied footer block XML here with the following modification:​ \\ \\ <​code> ​    <​remove name="​footer"/>​
 <​reference name="​root">​ <​reference name="​root">​
Line 39: Line 41:
        ...        ...
      </​block>​      </​block>​
-</​reference></​code>​ 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"''​.+</​reference></​code>​ 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.+==== Note ==== 
 +''​Blocks HTML output'' ​should remain disabled under **System > Cache Management** in the Magento Admin Panel.
  
  • Admin
  • Last modified: 2016/09/26 18:32
  • by Rob Holda