0

I seem to have a chicken/egg situation that I cannot resolve. I'm using WURFL to sniff mobile clients for my site and varying content based it. This happens in a Controller_Plugin.

I'm looking at adding page caching, but as far as I know, that can only be initiated in the bootstrap. In order to cache pages correctly, I need to know if the page is mobile or not, but I don't have that data until later on down the road, so to speak...

Maybe someone who understands the Zend Application workflow would know where I could sneak in the page caching after getting the user agent info, or is it too late at that point?

stagl
  • 501
  • 3
  • 18
  • Are you wanting to cache pages differently for mobile devices? Or only cache for mobile devices? – Tim Fountain Apr 04 '14 at 23:36
  • I need to cache the pages different for mobile, yes. I'm building page cache keys based off of URI, QUERY_STRING and other _SERVER vars. I can save IS_MOBILE in the _SERVER array, but it is after the bootstrap... – stagl Apr 05 '14 at 00:34
  • First at all I would prefer to use an proxy cache like varnish. For ``Zend\Cache\Frontend\Page`` your simply have to call the method ``start`` with a different id argument in both cases. this can be done on controller level after bootstrap. – mabe.berlin Aug 14 '14 at 19:49
  • @mabe.berlin yes, varnish is on my radar. I'm very interested on how to work with dynamic content with varnish and have been studying ESIs for a little while now. In the interim, I was able to solve this problem by moving the WURFL plugin into my bootstrap and my pagecache into a plugin; basically swapping the locations in the call stack. – stagl Aug 15 '14 at 20:46

0 Answers0