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
Next revision Both sides next revision
litespeed_wiki:cache:litemage:customization [2015/11/12 19:51]
Michael Alegre [How to handle private information inside of a public block]
litespeed_wiki:cache:litemage:customization [2016/04/15 19:48] (current)
Rob Holda
Line 1: Line 1:
 ====== LiteMage Cache Customization ====== ====== LiteMage Cache Customization ======
- +|[[litespeed_wiki:​cache:​litemage:​customization:​configuration-file|Configuration File Customization]]|Customizing ​LiteMage's configuration file.| 
-This page is dedicated to covering common methods of customizing ​LiteMage ​Cache for different use cases+|[[litespeed_wiki:​cache:​common:​seperate-mobile-versions|Websites With Separate Mobile Versions]]|Handling websites ​with separate ​mobile ​versions.| 
-===== Handling ​Websites With Separate Mobile Versions ​===== +|[[litespeed_wiki:cache:common:​views-based-on-cookie-values|Setting Views Based On Cookie Values]]|Setting different views for the same URL based on customized cookie ​values.| 
- +|[[litespeed_wiki:​cache:​litemage:​customization:​private-info-in-public-block|Private ​Info In A Public Block]]|Handling ​private information inside of a public block.| 
-LiteMage may not work properly ​with websites that have separate ​Mobile ​versions ​using a different skin than the main site+|[[litespeed_wiki:cache:litemage:customization:​non-standard-message-blocks|Non-Standard ​Message Blocks]]|Using ​customized ​message ​blocks not derived from "​Mage_Core_Block_Messages"​.| 
- +|[[litespeed_wiki:cache:​litemage:​customization:​separate-front-page-footer|Using A Separate Footer On Your Front Page]]|Handling ​dynamically determined separate footer for the home page.| 
-In such cases, you can tell LiteMage to cache the website'​s Mobile version differently than the main version so they are not mixed up. Do this by adding the following to the .htaccess file: +|[[litespeed_wiki:cache:​common:​geoip-support|GEOIP Support]]|How to enable GEOIP support| 
- +|[[litespeed_wiki:​cache:​litemage:​customization:​keeping-public-cache-warm-indefinitely|Keeping Public Cache Warm Indefinitely]]| Customizing ​LiteMage'​s ​crawler so your content is updated but users never hit the backend.|
-<​code>​ +
-RewriteCond %{HTTP_USER_AGENT} android|avantgo|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge\ |maemo|midp|mmp|opera\ m(ob|in)i|palm(\ os)?​|phone|p(ixi|re)\/​|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows\ (ce|phone)|xda|xiino ​[NC,OR] +
-RewriteRule .* - [E=Cache-Control:vary=ismobile] +
-</​code>​  +
- +
- +
-LiteMage supports this feature as of LSWS version 5.0.7. +
- +
-**Important:** Your rewrite rules must exactly match your backend'​s mobile detection. If these do not match, you may run into the issue where your rewrite rules think that a device is mobile while the backend does not and visa-versa. This can cause, for example, the desktop version of a page to be cached and flagged as the mobile version which will then be wrongly served to all mobile viewers. +
- +
- +
-===== Setting ​Different ​Views For The Same URL Based On Customized ​Cookie Values ​===== +
- +
-This is a feature as of version 1.0.1. To enable it, you should add the customized cookie name in the configuration. Do this from the Magento Admin Panel by navigating to System → Configuration and under "​LITEMAGE CACHE" click on "​LiteMage Configuration"​. Then under "​General Settings"​ look for "​Separate Cache Copy for Customized Cookie Values"​ and add the customized cookie ​name to the list+
- +
-==== Handling ​Private ​Information Inside Of A Public Block ==== +
- +
-Private holes can only be punched at the block level. If a piece of private information does not have its own block, we have to add a block in order to inject the ESI process.  +
- +
-For example, a user review input form is integrated into a product page by a customized theme. The form can be varied according to each product, and the default nickname is varied by each logged in user. You cannot simply configure the whole page/block to be private.  +
- +
-As of version 1.0.2, sample code has been added to demonstrate how to handle ​private information inside of a public block. ​There are a few steps to be followed. +
- +
- +
-    * In the corresponding layout file, add a block. For examplecustomized_theme/​layout/​catalog.xml +
-old: +
-                <block as="​review_form"​ name="​product.review.form"​ template="​review/​form.phtml"​ type="​review/​form"/>​ +
-new: +
-                 <​block as="​review_form"​ name="​product.review.form"​ template="​review/​form.phtml"​ type="​review/​form">​ +
-                    <block type="litemage/​inject_nickname"​ name="​nickname"​ as="​nickname"/>​ +
-                </​block>​ +
- +
-The sample code is shipped by default under Litemage/​Block/​Inject/​Nickname.php. +
- +
-    * Modify the template to use the newly injected block for the value. +
-old  +
-  <input type="​text"​ name="​nickname"​ id="​nickname_field"​ class="​input-text required-entry" value="​php echo $this->​htmlEscape($data->​getNickname()) ?>" required/>​ +
- +
-new:    +
-   <​input type="​text"​ name="​nickname"​ id="​nickname_field"​ class="​input-text required-entry"​ value="<?​php echo $this->​getChildHtml('​nickname'​) ?>" required/>​ +
- +
-  * Since this is inside the value quote, you must add $v after the block name or block type in LiteMage'​s config.xml to avoid extra info/debug info from being output to browser.  +
- +
-Again, if you have any customizations,​ please make these changes in your local directory or create a backup as they will otherwise be overridden by future LiteMage updates. +
- +
-===== Using Customized ​Message Blocks ​Not Derived From "​Mage_Core_Block_Messages"​ ===== +
- +
-If you are using customized ​messages ​blocks not derived from "​Mage_Core_Block_Messages"​, such as what is talked about in inchoo'​s ​[[http://​inchoo.net/​magento/​styling-magento-global-messages/|Fancy Magento Global Messages]] article, LiteMage may have trouble detecting these message blocks automatically. +
- +
-As of LiteMage 1.0.9, we have added both support and convenient new customization field in the Magento Admin Panel under System >> Configuration >> LITEMAGE_CACHE >> LiteMage Configuration called "​Customized Block Names for '​message'​ Tag" that can be used to define customized message blocks that render from a template+
- +
-All you have to do is add the name field from the same XML tag you used to define your block type to the the comma separated list "​Customized Block Names for '​message'​ Tag". If we use the previously mentioned inchoo article as an example, this tag would look like: +
-   +
-  <block type="​core/​template"​ name="​inchoo_global_messages"​ template="​core/​inchoo_global_messages.phtml"​ before="​-" /> +
-   +
-Where we would add "​inchoo_global_messages"​ to the "​Customized Block Names for '​message'​ Tag" list. This also has the added benefit of being saved to the Magento database, meaning you will not be required to re-apply these changes when updating as you would in LiteMage'​s ​"​config.xml"​ file.+
  • Admin
  • Last modified: 2015/11/12 19:51
  • by Michael Alegre