please, very urgent:how to store session variables?

Author Message

Alessandro Cipriani

Tuesday 09 March 2004 2:30:16 am

hi all
i've this GREAT problem due to my need to store a variable in session and to the lack of documentation (and forum answers) about it.
i've seen also some documentation here:
http://doc.ez.no/class_ref/doc/view/ezsession5a62.html?PrintableVersion=enabled#999999
but i don't understand how to use the example in it!!!
i even tried to insert the code into the index.php code, but i get only a fatal error...

i said: if there is the possibility to store variable values in session, WHY there isn't enough documentation about it????

best regards
alessandro

Bård Farstad

Tuesday 09 March 2004 2:48:57 am

You can set a session variable by doing:
$http =& eZHTTPTool::instance();
$http->setSessionVariable( "MyVar", "MyValue" );

You can read the session variable by doing:
if ( $http->hasSessionVariable( "MyVar" ) )
$myVar = $http->sessionVariable( "MyVar" );

This is PHP code, you cannot set session variables in templates.

--bård

Documentation: http://ez.no/doc

Alessandro Cipriani

Tuesday 09 March 2004 2:53:04 am

thanx bard?
just other 2 questions: where should i place this code? into the index.php file?
there is the possibility to retrieve a timestamp (or session id) into this code and store it in a session variable?

best regards
alessandro

Alessandro Cipriani

Tuesday 09 March 2004 6:24:09 am

bard
i can't get the session variable into the template since the language is php right?
so, can you explain me where should i write the code that retrieves the value and how to pass it to the template?

best regards
alessandro

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 19 2025 01:03:24
Script start
Timing: Jan 19 2025 01:03:24
Module start 'layout'
Timing: Jan 19 2025 01:03:24
Module start 'content'
Timing: Jan 19 2025 01:03:25
Module end 'content'
Timing: Jan 19 2025 01:03:25
Script end

Main resources:

Total runtime1.4069 sec
Peak memory usage4,096.0000 KB
Database Queries60

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0080 589.2891152.6406
Module start 'layout' 0.00800.0037 741.929739.4922
Module start 'content' 0.01181.3936 781.4219560.2031
Module end 'content' 1.40530.0016 1,341.625012.1250
Script end 1.4069  1,353.7500 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00360.2554160.0002
Check MTime0.00140.0990160.0001
Mysql Total
Database connection0.00150.107810.0015
Mysqli_queries1.344495.5547600.0224
Looping result0.00060.0416580.0000
Template Total1.365697.120.6828
Template load0.00240.167520.0012
Template processing1.363296.893620.6816
Template load and register function0.00010.006510.0001
states
state_id_array0.00130.089110.0013
state_identifier_array0.00250.177120.0012
Override
Cache load0.00210.1505370.0001
Sytem overhead
Fetch class attribute can translate value0.00050.036720.0003
Fetch class attribute name0.00260.183160.0004
XML
Image XML parsing0.00110.076720.0005
class_abstraction
Instantiating content class attribute0.00000.001380.0000
General
dbfile0.00090.0648230.0000
String conversion0.00000.000640.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
4content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
8content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
8content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 26
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs