Developer forum

Forum » Templates » Cache old cookiewarnings

Cache old cookiewarnings

Martin Kure
Reply

Hi, 

I have a problem building cookiewarnings in old DwStylesheets.

I wrap external plugins, that add cookies in this conditional:

 

<!--@If(Global:CookieOptInLevel = "All")-->
 ...Content...
<!--@EndIf--> 

So these plugins are only displayed, whenever the user clicks "ok" to the cookie warning pop up. 

This works fine in template based design, but in the old DwStyleSheets, the system is caching the content serverside. The cached parts are storing old values of <!--@Global:CookieOptInLevel-->, it seems. So whenever I refresh the page, the value is not being changed and the content remains hidden. However this doesn't happen in the master, but in the paragraph templates.

Whenever I delete the cache in the backend filarkiv-->cache, the value instantly changes to the correct value and displays/hides content as it should.

I can't ask the customer to go to the individual pages and set the local cache on the page not to be stored. I can foresee a lot of trouble for my customers, who will forget about this extra action, and a lot of times will experience content, that is not being displayed.  

So, I was hoping, that there was a tag or an easy fix, to remove the cache frem specific templates.

Regards

Martin 


Replies

 
Nicolai Høeg Pedersen
Reply

Hi Martin

You can only disable content cache using the page properties.

If you have the tag in the master or page template and not a paragraph template, it should not be cached.

 
Martin Kure
Reply

Hi Nicolai,

Thank you for getting back to me. 

A lot of plugins are added in the master, and it doesn't get cached. So that's all good. 

But I wanna make a paragraph-template that detects if users have allowed cookies and only thereafter publish content. That way people can safely insert youtube videoes, facebook embeds etc.. All that and still making sure, that these embeds won't set their own cookies, unless allowed by the user.

Is there a work around?

Regards

Martin

 

 

 

 
Nicolai Høeg Pedersen
Reply
This post has been marked as an answer

You can create a notification subscriber listening to Notifications.Standard.Page.Loaded and set PageView.Current.Page.Value("PageCacheMode") = 0.

Or disable the cache in the UI...

Votes for this answer: 1
 
Martin Kure
Reply

Hi Nicolai, 

can you disable the cache globally on the entire domain?

 

 
Nicolai Høeg Pedersen
Reply

Nope, only on the pages.

 
Martin Kure
Reply

Hi Nicolai, 

can you elaborate on this example, please :-).

 Notifications.Standard.Page.Loaded and set PageView.Current.Page.Value("PageCacheMode") = 0.

Regards

Martin

 
Nicolai Høeg Pedersen

 

You must be logged in to post in the forum