Finish & output

When you're done with setting variables and parsing your blocks, it's time to write the contents to your client. At first, you need to parse() the contents of the file handle into a new handle.

To remove all unused variables and blocks, you might want to call finish(). Depending on the value set for unknowns (as second paramter in the constructor, or via setUnknowns()), unused variables are either erased (remove), kept (keep) or commented out (comment).

To echo your HTML, either directly use the return value of finish(), or use get() to retrieve the content.

Finishing a file and writing it out

<?php
$t
->parse('OUT''authors');
$htmlcode $t->finish(
    
$tpl->get('OUT')
);
echo 
$htmlcode;
?>

Finishing a file and writing it out, the easy way

<?php
echo $tpl->finish($t->parse('OUT''authors'));
?>
Parsing blocks (Previous) HTML_Template_Sigma (Next)
Last updated: Wed, 30 Jul 2014 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report or add a note.
View this page in:

User Notes:

There are no user contributed notes for this page.