O'Reilly logo

Mastering Joomla! 1.5 Extension and Framework Development by Chuck Lanham, James Kennard

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The session

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, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required