Actions

JURI/getVar

From Joomla! Documentation

Revision as of 15:27, 24 August 2009 by Chris Davenport (Talk | contribs)

Returns an individual query item value from the query part of the URI represented by the URI object.

Syntax

string getVar( $name, $default )

where:

Argument Data type Description Default
$name string Name of the query item. null
$default string Default value that will be returned if the named query item does not exist. null

Example

$uri = 'http://fredbloggs:itsasecret@www.example.com:8080/path/to/Joomla/index.php?task=view&id=32#anchorthis';
$u =& JURI::getInstance( $uri );
echo 'task is ' . $u->getVar( 'task', 'save' ) . "\n";
echo '  id is ' . $u->getVar( 'id' ) . "\n";
echo ' act is ' . $u->getVar( 'act', 'logout' ) . "\n";

would output

task is view
  id is 32
 act is logout

See also