Drupal uses persistent session storage -- in the database -- which is what lets your login persist. Session data is stored too.<br><br>The simple way around this is to also store a session expiration time for your display. If that time has passed, clear both session variables and reset them.<br>
<br>From a security and best practice standpoint, please don&#39;t put this logic in a tpl file. It belongs in a module or theme preprocess function. Set $show_animation as part of the variables you pass to the template.<br>
<br>----------------------------------------------------------------------<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Message: 1<br>
Date: Thu, 19 Apr 2012 09:12:03 +0200<br>
From: Bert Van Kets &lt;<a href="mailto:mailing@vankets.com">mailing@vankets.com</a>&gt;<br>
Subject: [themes] session variable in page--front.tpl.php<br>
To: <a href="mailto:themes@drupal.org">themes@drupal.org</a><br>
Message-ID: &lt;<a href="mailto:4F8FBAC3.8000903@vankets.com">4F8FBAC3.8000903@vankets.com</a>&gt;<br>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed<br>
<br>
Hi,<br>
<br>
I&#39;m using D7 and need a way to show an animation only once when a<br>
visitors comes to the site.<br>
I am using a session variable in my page--front.tpl.php file and if it&#39;s<br>
not set, it shows the animation. Code snips below.<br>
For some reason though once the animation is shown on a PC, it is not<br>
shown again at all. Even when the browser is closed and I wait a day.<br>
When I log into the site and log out, the animation is shown fine. I<br>
assume the session is reset to clear all the authorization data and<br>
that&#39;s why the animation is shown.<br>
<br>
I thought it was the caching that kept the animation from showing, but<br>
even setting the cache lifetime to 1 minute does not solve the problem.<br>
There must be something else going on. Does anybody have an idea on what<br>
may be blocking the animation?<br>
<br>
Is there an alternative way to get this conditional presentation going?<br>
I have read cookies are not recommended.<br>
<br>
Thanks for any help.<br>
<br>
Bert<br>
<br>
Code snip:<br>
<br>
&lt;?php<br>
if(! isset($_SESSION[&#39;showAnimation&#39;])):<br>
?&gt;<br>
<br>
&lt;javascript block containing the animation. Everything is in javascript so the animation does not block the site if JavaScript is not supported./&gt;<br>
<br>
&lt;?php<br>
endif;<br>
$_SESSION[&#39;showAnimation&#39;]=1;<br>
?&gt;<br>
<br>
<br>
<br>
<br>
------------------------------<br>
<br>
_______________________________________________<br>
themes mailing list<br>
<a href="mailto:themes@drupal.org">themes@drupal.org</a><br>
<a href="http://lists.drupal.org/mailman/listinfo/themes" target="_blank">http://lists.drupal.org/mailman/listinfo/themes</a><br>
<br>
<br>
End of themes Digest, Vol 61, Issue 1<br>
*************************************<br>
</blockquote></div><br><br clear="all"><br>-- <br>Ken Rickard<br><a href="mailto:agentrickard@gmail.com">agentrickard@gmail.com</a><br><a href="http://ken.therickards.com">http://ken.therickards.com</a><br>