API16

JSession/get

From Joomla! Documentation

< API16:JSession
Revision as of 17:42, 22 March 2010 by Doxiki (talk | contribs) (New page: ===Description=== Get data from the session store <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>Edit Descripton<nowiki>]</nowiki> <...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

The "API16" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

Description[edit]

Get data from the session store

[Edit Descripton]

Template:Description:JSession/get

Syntax[edit]

get($name, $default=null, $namespace= 'default')
Parameter Name Default Value Description
$name Name of a variable
$default null Default value of a variable if not set
$namespace 'default' Namespace to use, default to 'default'

Returns[edit]

mixed Value of a variable

Defined in[edit]

libraries/joomla/session/session.php

Importing[edit]

jimport( 'joomla.session.session' );

Source Body[edit]

public function get($name, $default = null, $namespace = 'default')
{
        $namespace = '__'.$namespace; //add prefix to namespace to avoid collisions

        if ($this->_state !== 'active' && $this->_state !== 'expired') {
                // @TODO :: generated error here
                $error = null;
                return $error;
        }

        if (isset($_SESSION[$namespace][$name])) {
                return $_SESSION[$namespace][$name];
        }
        return $default;
}

[Edit See Also] Template:SeeAlso:JSession/get

Examples[edit]

<CodeExamplesForm />