Template Filling, NucluesCMS way
Here's a snippet of code taken from NP_Blogroll to show how someone can utilize Nucleus's build-in class to do template token replacement.
Say we have a few template var <%var1%>, <%var2%>, <%var3%>.
// The text with template vars to be processed
$text = "I have <%var1%> to be <%var2%>, at <%var3%>";
// Setup value for each template var
$Vars = array (
'var1' => "a dog",
'var2' => " walked",
'var3' => "home"
);
// processing the text and fill in the template var
TEMPLATE::fill($text, $Vars);
Handy!
Comments
No comments yet