-
Book Overview & Buying
-
Table Of Contents
Mastering Joomla! 1.5 Extension and Framework Development Second Edition
By :
When a user accesses Joomla!, a new session is created; this occurs even if the user is not logged in. Instead of accessing the $_SESSION hash as we do in most PHP applications, we must use the global JSession object.
W
hen we access session data, we provide the value name and, optionally, the namespace. If we do not provide a namespace, the default namespace aptly named default is assumed. In this example, we retrieve the value of default.example:
$session =& JFactory::getSession();
$value = $session->get('example');It is unusual when we are accessing the session in this way to use anything other than the default namespace. That is why the second parameter in the get() method is not the namespace but the default value. In this example, we retrieve the value of default.example, returning a value of 1 if the value does not exist:
$session =& JFactory::getSession();
$value = $session->get('example', 1);The last parameter is the namespace. This example demonstrates how...
Change the font size
Change margin width
Change background colour