ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Cookie Module and Cached templates

May 29, 2012 5:35am

Subscribe [2]
  • #1 / May 29, 2012 5:35am

    PaulAyling

    16 posts

    Hiya

    I’ve just used the cookie module to implement the EU cookie law
    and came across the following problem.

    On cached templates, when try and use the delete cookies
    or agree cookies it fails on these. Or more rightly
    says it working but then keeps the state the same until
    the cache refreshes.


    When i turn caching off it works as you’d expect.

    Any way question is should it work with cached templates.

    Cheers
    Paul

  • #2 / May 30, 2012 10:55am

    Shane Eckert

    7174 posts

    Hello PaulAyling,

    Thank you for posting your question here on the ExpressionEngine forums.

    I believe that this is the expected behavior. You may want to turn caching off on the template used for this function.

    Cheers,

  • #3 / May 30, 2012 11:04am

    PaulAyling

    16 posts

    Hey Shane

    Thanks for the reply.

    Slight issue with that then, EU law means needs to be on all pages, so means caching off for
    most of the site. Not great

    Ah well
    Paul

  • #4 / May 30, 2012 11:07am

    Shane Eckert

    7174 posts

    Hi PaulAyling,

    Let me check with the Devs, there may be more to this than I am aware of.

    Hold tight.

  • #5 / May 30, 2012 11:09am

    PaulAyling

    16 posts

    Thanks for checking 😊

  • #6 / May 31, 2012 4:05pm

    Shane Eckert

    7174 posts

    Hey Paul,

    So turns out you can get around it.

    Put the Cookie Module bits that you want to use in an embed or a snippet, which is not cached. Done.

    Is there anything else I can do for you?

    Cheers,

  • #7 / Jun 01, 2012 2:03am

    PaulAyling

    16 posts

    Hi Shane

    Sorry no go, that’s exactly how I have it setup, I have 2 snippets one to load a bar at the top of the site to allow opt in and out, and another to either load php-ga or the standard GA code in the header.

    It works well with the template caching off but turn it on it fails.

    I have also tried in line in the template :(

    snippit looks like this:

    
    									
  • #8 / Jun 07, 2012 3:13pm

    Shane Eckert

    7174 posts

    Hey Paul,

    That’s a surprise to me. I am working on getting an answer from the Devs on this. Please stay tuned.

    Thanks,

  • #9 / Jun 08, 2012 3:41am

    PaulAyling

    16 posts

    Cheers Shane

    Paul

  • #10 / Jun 12, 2012 12:18pm

    Robin Sowell

    13255 posts

    Ah- while a snippet would be generally preferable in this situation as it’s really a simple text swap?  Try using an embed instead of a snippet to hold your cookie code.  Given the way pages are put together, that should work as long as the embedded template is not cached.  (The one with the embed on it can be cached.)

  • #11 / Jun 18, 2012 3:48am

    PaulAyling

    16 posts

    Hi Shane and Robin

    Moved to embeds and is working fine, thanks for the perseverance 😊

    Cheers
    Paul

  • #12 / Jun 18, 2012 9:48am

    Robin Sowell

    13255 posts

    😉  Glad that did the trick - and thanks for the confirmation!

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases