Download and unzip the Session Variables plugin, then follow the simple steps below:
ExpressionEngine 2.x:
ExpressionEngine 1.x:
Download and unzip the latest version of the Session Variables plugin, then follow the steps below:
ExpressionEngine 2.x:
ExpressionEngine 1.x:
// setting the language variable to french
{exp:session_variables:set name="language" value="french"}
// setting the language variable to the second segment
{exp:session_variables:set name="language" value="{segment_2}"}
// setting the language variable to the posted value
{exp:session_variables:set name="language" value="POSTED_VALUE"}
// getting the language variable
You are currently viewing this page in {exp:session_variables:get name="language"}
// deleting the language variable
{exp:session_variables:delete name="language"}
The lifetime of the session is set in the php.ini file (session.gc_maxlifetime) and is 1440 seconds by default. It can be changed using the ini_set function, however it can be reset in unpredictable ways. This article explains how and why.