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
|