Class for Template Evaluation: bare-bones counterpart of the Python library "Jinja"
DEPENDENCIES: None
USAGE EXAMPLES:
1) simple field substitution:
"Dear {{name}}, see you on {{day}}"
. This is Jinja-like (different delimeters may be requested)
2) if/then/else constructs:
{ [test] [if-branch string] [else-branch string] }
where test can be: 1) a field (true if not null) ; or 2) "field=string"
Example 1: "{ [phone] [are you still at {phone}?] [I lack your phone #] }"
Example 2: "{ [site=c] [some name] [some other name] }"
3) pre-registered, site-provided (NOT user-provided!), functions:
$templ_eval->registerFunction("foo"); // foo() become Registed Function 1 for this site
Example: "Go to link {RF(1, {productID})}"
public function setTags($openTag, $closeTag)
// To replace the default tags, if desired
public function evaluateTemplate($template, $replaceArray, $outputErrors = true)
/* Example of template: "Dear {{name}}, see you on {{day}}!"
Example of replaceArray: array("name" => "Valerie" , "city" => "SF")
Case-sensitive.
*/
function exactStringDisplay($str, $caption = "String")
/*
This function is just for debugging.
Assemble and return the HTML to display, inside a boxed div element, the given string EXACTLY as it is,
without any of the usual HTML printing substitutions.
For example "one<br><b>two</b>" will show up exactly as composed.
*/