Actions

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]]
<noinclude>[[Category:Development]][[Category:Framework]][[Category:JURI]]</noinclude>
+
<noinclude>[[Category:JURI]]</noinclude>

Latest 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.

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