SUIT Framework

Scripting Using Integrated Templates

Docs - setvariable

07/31/2010: SUIT 2.0.1 and Rulebox 1.1.0 released.

Available Since: Rulebox (1.0.0)

Set a variable based on a split string.

Syntax void templating.setvariable ( str string, str split, mixed assignment, mixed owner )
Parameters
string

The name of the variable to grab.

split

The string that separates the levels of the variable.

assignment

The value to assign to the variable.

owner

The object to grab the variable from.

Return Value

Nothing. The variable is modified.

Examples
Basic Usage
PHP
<?php
require 'suit.class.php';
require 'templating.class.php';
$suit = new SUIT();
$templating = new Templating($suit);
$templating->var->dict = array
(
    'foo' => 'bar'
);
$templating->setvariable('dict.foo', '.', 'foo', $templating->var);
/*
Result: Nothing. templating->var->dict is now the following:
array
(
    'foo' => 'foo'
)
*/
?>
Python
from rulebox import templating
templating.var.dict = {
    'foo': 'bar'
}
templating.setvariable('dict.foo', '.', 'foo', templating.var)
# Result: Nothing. templating.var.dict is now the following:
# {
#     'foo': 'foo'
# }