[support] Session variable and cache

Bert Van Kets mailing at vankets.com
Wed Apr 18 07:53:44 UTC 2012


Hi all,

I have a D7 website that needs to show an animation when the user enters 
the site, but not for as long as the user stays on the site.
I wanted to use a session variable for this, but it seems there are many 
times the animation is not triggered. I assume this is due to caching of 
the page. How can I overcome this? Is there a cache save session 
variable or an alternative method used in situations like mine.

At the start of the animation part I have the code
<?php
if(! isset($_SESSION['showAnimation'])):
?>

at the end of the part I have
<?php
endif;
$_SESSION['showAnimation']=2;
?>

So when the user first visits the site, the variable is not found and 
the animation is show. After the animation the session variable is set 
and the animation is not shown any more. That last version is cached and 
the animation is not shown, even for the next user who visits the site.

Thanks for any help.

Bert




More information about the support mailing list