Forums / Developer / Problem with session variable !
Fabien Garnier
Tuesday 26 August 2008 8:51:49 am
Hi everybody !
I try to use session variable in eZ.
I do this :In my extension, in testview.php file, i have this code :
$tab = renvoiTab(); //return an array from a web service $http = eZHTTPTool::instance(); if ($http->hasSessionVariable("stuff")) { echo "session existante"; } else {$http->setSessionVariable( 'stuff', $tab );} $var = $http->sessionVariable("stuff"); $tpl->setVariable('result',$var);
and in my template (testview.tpl), i do this :
<table> <tr> <th align=center>Nom</th> <th align=center>Modele</th> <th align=center>Nombre de Place</th> </tr> {foreach $result as $v} <tr> <td align=center>{$v.Nom}</td> <td align=center>{$v.Modele}</td> <td align=center>{$v.NbPlace}</td> </tr> {/foreach} </table>
and my session variable "stuff" never changes (while my web service result changes) even if i close the window or logout.
Do i use session variable correctly ?How to destroy a session in ez ?
Best regards
FG
Pascal Specht
Tuesday 26 August 2008 9:00:51 am
Hi Fabien,
I'm not sure about this, but could it be that you're victim of the cache mechanism? Does your code work if you disable caching?
</Pascal>
Tuesday 26 August 2008 11:39:48 pm
I have these lines in my "site.ini.append.php" since the beginning :
[OverrideSettings] Cache=disabled
Do you have another idea ?I think my problem is that I don't know how to close a session but i'm not sure...
Thank you for your help.