SUIT Framework

Scripting Using Integrated Templates

Docs - walk

12/27/2015: SUIT Framework is no longer actively maintained.

Available Since: SUIT (2.0.0)

Walk through the tree and generate the string.

Syntax str suit.walk ( dict rules, dict tree [, dict config ] )
Parameters
rules

The rules used to specify how to walk through the tree.

tree

The tree to walk through.

config

Specifics on how the function should work. (Optional. Default: see defaultconfig)

Return Value

The generated string.

Examples
Basic Usage
Template
Hello, <strong>[var]username[/var]</strong>!
PHP
<?php
require 'suit.class.php';
require 'templating.class.php';
$suit = new SUIT();
$templating = new Templating($suit);
$templating->var->username = 'Brandon';
$tokens = $suit->tokens($templating->rules, $template);
$tree = $suit->parse($templating->rules, $tokens, $template);
echo $suit->walk($templating->rules, $tree);
// Result: Hello, <strong>Brandon</strong>!
?>
Python
import suit
from rulebox import templating
templating.var.username = 'Brandon'
tokens = suit.tokens(templating.rules, template)
tree = suit.parse(templating.rules, tokens, template)
print suit.walk(templating.rules, tree)
# Result: Hello, <strong>Brandon</strong>!
See Also