Parsing blocks

Once you filled all variables in a block, you want to "save" them to be able to re-use the block another time. Method parse() is useful here. First parameter is the variable/handle in which the block content shall be stored, second is the handle name of the block. The optional third parameter tells if you want to append the block content to the handle value or not - it defaults to false, but you probably want to do that.

Parsing a block

<?php
foreach ($authors as $name => $email) {
    
$t->setVar('AUTHOR_NAME'$name);
    
$t->setVar('AUTHOR_EMAIL'$email);
    
$t->parse('authorline_ref''authorline'true);
}
?>

In this example, handle authorline_ref is filled with the contents of block authorline. If the third parameter would be false instead of true, only the last line would be in it at the end.

Setting variables (Previous) Finish & output (Next)
Last updated: Sat, 16 Feb 2019 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report.
View this page in:
  • English

User Notes:

There are no user contributed notes for this page.