Problem with session variable !

Author Message

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>

Fabien Garnier

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.

FG

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 15:18:52
Script start
Timing: Jan 18 2025 15:18:52
Module start 'layout'
Timing: Jan 18 2025 15:18:52
Module start 'content'
Timing: Jan 18 2025 15:18:52
Module end 'content'
Timing: Jan 18 2025 15:18:52
Script end

Main resources:

Total runtime0.0181 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0058 589.0469152.6250
Module start 'layout' 0.00580.0044 741.671939.4453
Module start 'content' 0.01030.0055 781.117289.4453
Module end 'content' 0.01570.0023 870.562534.3047
Script end 0.0180  904.8672 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002815.2422140.0002
Check MTime0.00116.3256140.0001
Mysql Total
Database connection0.00052.974010.0005
Mysqli_queries0.003821.186130.0013
Looping result0.00000.192810.0000
Template Total0.00179.310.0017
Template load0.00105.794710.0010
Template processing0.00063.483710.0006
Override
Cache load0.00073.971010.0007
General
dbfile0.00052.999080.0001
String conversion0.00000.084540.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs