Difference between revisions of "JURI/getVar"

From Joomla! Documentation

m (Mismatched argument names.)
m (See also: re-categorisation)
Line 38: Line 38:
* [[JURI/setVar|JURI->setVar]]
* [[JURI/setVar|JURI->setVar]]
* [[JURI/delVar|JURI->delVar]]
* [[JURI/delVar|JURI->delVar]]

Revision as of 11:34, 9 August 2012

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


string getVar( $name, $default )


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


$uri = '';
$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