It seems that mobile isn't compatible with CE Cache. Or the other way around. Can this be solved? When caching a page, you only see the desktop version of the template. The mobile template isn't loaded.

Thanks in advance! Diederik.


You should be able to cache both versions with CE Cache. You just need to place a variable into the CE Cache id parameter that differentiates between the mobile and regular versions of the website. I haven't tested it but the following should work:

{exp:ce_cache:it id="page-{is_mobile}" seconds="3600"}

If the {is_mobile} global variable doesn't work you could also try with {segment_1}. According to the docs on devot:ee, it's meant to be prefixed with 'mobile__'.

Because of the lack of extension hooks during the stage where Mobile works its magic, I had to hack into the segment variables array to make this work. Because of that, when using native EE routing (not with Pages or Structure), {segment_1} will also be prefixed with mobile__ in the mobile templates.

I've done this on a Structure based site that used Zoo Triggers. Zoo Triggers overwrites the segment variables behind the scenes which means caching doesn't work for similar reasons. The code I used in that instance looked like this:

{exp:ce_cache:it id="news_index-{triggers:segment_2}-{triggers:segment_3}-{triggers:segment_4}" seconds="3600"}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.