Helix Installation   Getting Started   Reference Documentation   Global Functions   Quick Start
Getting StartedHelpful ResourcesAsk questions on the Help ForumRead the User GuideBrowse the Reference DocumentationSubscribe to the Helix Mailing ListLearning HelixAdvanced Topics

Helix Sessions

Helix has the ability to carry information from one request to the next using sessions.  Every first-time request creates a new session in the Helix database, and sets a cookie with a single unique identifier for that session.  Then, in subsequent requests, the Helix parser will load a session object containing any information from the previous request based on the unique identifier in the cookie.

Since sessions are stored in the Helix database, there is no need to use the PHP session handling functions.

Retrieving Session Data

When information needs to be passed from one request to the next, you can simply register the data with the global $sess object and then access it on the next request.  You can register any type of variable -- a single value, an object or an array.

See the code below for an example of registering some data in the session object, and then retrieving it on a later request.

<?php
    
// Store some information in a variable
    
$my_name "John Doe";
    
    
// Register that data in the session
    
$sess->register("name",$my_name);
?>
<?php
    
// Retrieve the session data stored in "name"
    
$name_from_session $sess->data["name"];
?>
Get Helix PHP Framework at SourceForge.net. Fast, secure and Free Open Source software downloads