[themes] session variable in page--front.tpl.php
Bert Van Kets
mailing at vankets.com
Thu Apr 19 07:12:03 UTC 2012
Hi,
I'm using D7 and need a way to show an animation only once when a
visitors comes to the site.
I am using a session variable in my page--front.tpl.php file and if it's
not set, it shows the animation. Code snips below.
For some reason though once the animation is shown on a PC, it is not
shown again at all. Even when the browser is closed and I wait a day.
When I log into the site and log out, the animation is shown fine. I
assume the session is reset to clear all the authorization data and
that's why the animation is shown.
I thought it was the caching that kept the animation from showing, but
even setting the cache lifetime to 1 minute does not solve the problem.
There must be something else going on. Does anybody have an idea on what
may be blocking the animation?
Is there an alternative way to get this conditional presentation going?
I have read cookies are not recommended.
Thanks for any help.
Bert
Code snip:
<?php
if(! isset($_SESSION['showAnimation'])):
?>
<javascript block containing the animation. Everything is in javascript so the animation does not block the site if JavaScript is not supported./>
<?php
endif;
$_SESSION['showAnimation']=1;
?>
More information about the themes
mailing list