JURI/getVar
From Joomla! Documentation
< JURI(Difference between revisions)
(New page: Returns an individual query item value from the query part of the URI represented by the URI object. ===Syntax=== string getVar( $name, $default ) where: {| class="wikitable" !Argument !D...) |
m (Mismatched argument names.) |
||
| Line 15: | Line 15: | ||
|'''null''' | |'''null''' | ||
|- | |- | ||
| − | |$ | + | |$default |
|string | |string | ||
|Default value that will be returned if the named query item does not exist. | |Default value that will be returned if the named query item does not exist. | ||
Revision as of 15:27, 24 August 2009
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