Your EE module, plugin, and extension marketplace!
This is an Expression Engine plugin that allows you to store variables in PHP's native session.
* Current Version: 1.0 (released 7 April 2008)
* Works with ExpressionEngine 1.6 and higher.
Sometimes you may want to temporarily store a variable for a short amount of time without writing a value to the database. Expression Engine's sessions do not allow this, however PHP's native sessions do.
This plugin allows you to use PHP's native session variables.
Find out more about PHP Sessions.
The session variables plugin works by using PHP's native session to store variables on the server. The variables can easily be set, retrieved and deleted.
Here are some examples of how to use it:
// 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 variable
{exp:session_variables:set name="language" value="POSTED_VARIABLE"}
// 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"}
When using the set function, the name parameter and value parameter are required.
POSTED_VARIABLE is a constant that specifies the value of the posted variable with the specified name (in the example above it would refer to $_POST['language']).
When using the get function, only the name parameter is required.
When using the delete function, only the name parameter is required.
Note: 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.