Jump to content

cache is not working properly for multiple templates


adrianmak
 Share

Recommended Posts

I have a pw site which has two set of templates. One if for desktop another one is for mobile device

I used a mobile detection library to load mobile template for mobile devices.

Here is the code snippet in config.php
 

require_once("mobile_detect.php");
$detect = new Mobile_Detect;
$config->mobile = false;
$config->prefix = "desktop";
if($detect->isMobile()) {
    $config->urls->templates = $config->urls->site . 'templates-mobile/';
    $config->paths->templates = $config->paths->site . 'templates-mobile/';
    $config->mobile = true;
    $config->prefix = "mobile";
}

It's working fine without template cache enabled.

If I enable a template cache, the mobile template is not working anymore. Mobile devices always load the cache of the desktop template.

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...