This is an old revision of the document!


LiteMage Cache Customization

LiteMage may not work properly with websites that have separate Mobile versions using a different skin than the main site.

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:

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]

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.

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.

If you are using customized messages blocks not derived from “Mage_Core_Block_Messages”, such as what is talked about in inchoo's 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 a 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:38
  • by Michael Alegre