| Tuesday 30 May 2006 9:45:35 am 
                                                                
                                                                 Hi all, I have a problem with setting a session variable in a php script and then retrieving it in a template. It seems easy, and maybe it is, but I've struggled for several hours... In my pagelayout.tpl I've included the following code : 
<p>My variable : {ezhttp('myvar','session')}</p><form method="post" action="/updateSession.php">
 	<input id="module_result_uri" type="hidden" name="module_result_uri" value="{$module_result.uri}" />	 
....</form>
 The file updateSession.php looks like : 
<?php$redirect_uri = $_POST['module_result_uri'];
 
include_once( "lib/ezutils/classes/ezhttptool.php" );$http =& eZHTTPTool::instance();
 $http -> setSessionVariable('myvar','value');
 header("location:$redirect_uri"); 
//print($http->sessionVariable('myvar'));print("<br/>");//print($http->sessionId());
 ?>
 The principle is that when the form is submitted, the php script sets some session variables (normally with submitted values) and then the original page is displayed and session-saved variables should be available for later operations. The problem is that when the original page is displayed again, the line {ezhttp('myvar','session')} does not display any value. I'm not sure I have well understood how Exponential sessions work (is there a configuration to do to access session variables in a template?), but finding information about it is rather hard... 
Any help or advice is really really welcome !Thanks.
 Emmanuel
 |