API15

API15:JRouter/setVar

From Joomla! Documentation

Description

Set a router variable, creating it if it doesn't exist

[<! removed edit link to red link >]

<! removed transcluded page call, red link never existed >

Syntax

setVar($key, $value, $create=true)
Parameter Name Default Value Description
$key $key The name of the variable
$value $value The value of the variable
$create true $create 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

function setVar($key, $value, $create = true) {

        if(!$create && array_key_exists($key, $this->_vars)) {
                $this->_vars[$key] = $value;
        } else {
                $this->_vars[$key] = $value;
        }
}

[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >

Examples

Code Examples