urgent! important! how to store session variables?????

Author Message

Alessandro Cipriani

Tuesday 09 March 2004 2:29:29 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

Alessandro Cipriani

Tuesday 09 March 2004 3:06:01 am

thank you mark
can you post some code please?
i'm quite new to this, but i must do it and i don't know h o w....

best regards
alessandro

Alessandro Cipriani

Tuesday 09 March 2004 3:59:04 am

thanks! it works perfectly!!!
just another question: in my index.php i'd like to get the session id or a timestamp (like currentdate()) in order to identify the current session with a unique value.
so if index.php is running for the first time (for this session) it should retrieve the unique number and store in the session. otherwise it should view that that value is already set and do nothing

questions:
- how to retrieve timestamp/sessionid?
- how to make index.php to know if the value of that variable is already set

thanks a lot mark!
you are being helpfull to me!!!!!

cheers
alessandro

Alessandro Cipriani

Tuesday 09 March 2004 4:05:53 am

mark when you write

value="{"Telephone"|session_variable}"/></td>

what do you mean with "session_variable"?

in my index.php i wrote:
$http =& eZHTTPTool::instance();
$http->setSessionVariable( "MyVar", "MyValue" );

and to retrieve the myVar value (MyValue) in my pagelayout.tpl i wrote:
{"MyVar"|session_variable}

but i doesn't work! i get MyVar, not his value... any hint

best regards
alessandro

Alessandro Cipriani

Tuesday 09 March 2004 5:11:08 am

mark please
can you be more clear?
should i write my own function?
if i should, where should i put the function?

is it the only way to retrieve session variables stored by httptool?

cheers
alessandro

Alessandro Cipriani

Tuesday 09 March 2004 5:12:19 am

can you post the session_variable function code?

best regards
alessandro

Alessandro Cipriani

Tuesday 09 March 2004 7:04:29 am

mark
thank you for the advice... :)
i'm not able to make it work, but i'll write you what i've done:

-index.php, after row 333 (eZSessionStart();)
added the following: $http =& eZHTTPTool::instance();
$http->setSessionVariable( "MyVar", "MyValue" );
[in this way i think i've set a session variable (MyVar) with value "MyValue"]

-eztemplatestringoperator.php, row 301
added the following: // return a session variable
case $this->SessionVariable:
{
include_once( "lib/ezutils/classes/ezhttptool.php" );
$http =& eZHTTPTool::instance();
$operatorValue = $http->sessionVariable("MyVar");
} break;
i wrote sessionvariable("MyVar") because i want to retrieve only the myvar value

-pagelayout.tpl: added the following:
{"MyVar"|SessionVariable}
i want to retrieve the session variable.

but in pagelayout i get "MyVar"... not myValue!!!!

i can give you my icq#: 326457502
help me please (then i'll take a very very long breath!!!)

cheers alessandro

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