| API | Package | Subpackage | Class | Method | Reference | Last reviewed | Doc status |
|---|---|---|---|---|---|---|---|
Home |
Joomla.Framework |
Application |
JApplication |
setUserState |
setUserState() |
Never | Work in Progress |
Sets the value of a user state variable. User state variables are stored with the session and are persistent between requests.
mixed setUserState ( $key, $value )
| $key | string | is a string containing the path of the state variable to set. |
| $value | string | is a string containing the value of the variable to store. |
If the following code is executed on a page load:
Example
global $mainframe; $mainframe->setUserState( "$option.sampleState", "Stored value" );
then the following code:
Example
global $mainframe; echo $mainframe->getUserState( "$option.sampleState" );
would produce
Result
Stored value