Actions

API15

JSession/get

From Joomla! Documentation

< API15:JSession
Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

Contents

Description

Get data from the session store

[<! removed edit link to red link >]

<! removed transcluded page call, red link never existed >

Syntax

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

Returns

mixed Value of a variable

Defined in

libraries/joomla/session/session.php

Importing

jimport( 'joomla.session.session' );

Source Body

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;
}

[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >

Examples

<CodeExamplesForm />