Jump to content

Recommended Posts

Posted

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.

 

Posted

That's to be expected. The template cache is just a quick way to cache pages of a specific template. It doesn't care about how the page is rendered. It identifies cache files just by the page id. If you need more control rather use WireCache.

Posted

if i want to mobile template and desktop template are both working with cache, how the wirecache could help me? could u please give me a little bit more details?

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
  • Recently Browsing   0 members

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