API16

JSession/has

From Joomla! Documentation

< API16:JSession
Revision as of 17:42, 22 March 2010 by Doxiki (talk | contribs) (New page: ===Description=== Check wheter data exists in the session store <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>Edit Descripton<nowiki...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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]

Check wheter data exists in the session store

[Edit Descripton]

Template:Description:JSession/has

Syntax[edit]

has($name, $namespace= 'default')
Parameter Name Default Value Description
$name Name of variable
$namespace 'default' Namespace to use, default to 'default'

Returns[edit]

boolean True if the variable exists

Defined in[edit]

libraries/joomla/session/session.php

Importing[edit]

jimport( 'joomla.session.session' );

Source Body[edit]

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

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

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

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

Examples[edit]

<CodeExamplesForm />