SUIT Framework

Scripting Using Integrated Templates

Docs - execute

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

Available Since: SUIT (2.0.0)

Transform a string using rules. The function calls tokens, parse, and walk all in one convenient call.

Syntax str suit.execute ( dict rules, str string [, dict config ] )
Parameters
rules

The rules to use to transform the string.

string

The string to transform.

config

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

Return Value

The transformed 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';
print $suit->execute($templating->rules, $template);
// Result: Hello, <strong>Brandon</strong>!
?>
Python
import suit
from rulebox import templating
templating.var.username = 'Brandon'
print suit.execute(templating.rules, template)
# Result: Hello, <strong>Brandon</strong>!
See Also