SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 248 | Next

James Kennard

"Mastering Joomla! 1.5 Extension and Framework Development"

In this example, we set the
value of default.example and someNamespace.example:
$session =& JFactory::getSession();
$session->set('example', 1);
$session->set('example', 1, 'someNamespace');
You might be wondering why we tend to use the default namespace. Due to
limitations of the namespace handling within the JSession class, we use a special area
of the session known as the 'user-state'.
The user-state is a JRegistry object that is stored in the session. The application
accesses this object, which is located in default.registry. There are two application
methods that we use, getUserState() and getUserStateFromRequest().
We'll start by exploring getUserState(). This example demonstrates how we can
retrieve the value of session.counter, a counter that represents the number of
requests a user has made:
$mainframe->getUserState('session.counter');
Chapter 7
[ 185 ]
Setting user-state values is very similar. This example demonstrates how we can set
an alternative template for a user:
$mainframe->setUserState('setTemplate', 'someSiteTemplate');
The getUserStateFromRequest() method is very similar to the getUserState()
method, except that it checks the request values first.


Pages:
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260
druga wojna światowa Free English grammar and study guid hotel jelenia góra Russian bride counter strike 1.6