API16:JRouter/setVar
From Joomla! Documentation
Description
Set a router variable, creating it if it doesn't exist
Syntax
setVar($key, $value, $create=true)
| Parameter Name | Default Value | Description |
|---|---|---|
| $key | The name of the variable | |
| $value | The value of the variable | |
| $create | true | If True, the variable will be created if it doesn't exist yet |
Defined in
libraries/joomla/application/router.php
Importing
jimport( 'joomla.application.router' );
Source Body
public function setVar($key, $value, $create = true)
{
if (!$create && array_key_exists($key, $this->_vars)) {
$this->_vars[$key] = $value;
} else {
$this->_vars[$key] = $value;
}
}
Examples
Code Examples