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.