PHPLib Templates - Aren't we done YET? (
Page 7 of 8 )
There's one last detail that I'd like to reinforce that I mentioned earlier.
Within the PHPLIB all variables are equal, even if they aren't created the same way. This is true of variables defined with set_file, set_var, or set_block!
To demonstrate this, let's take a look at four.ihtml:
<!-- BEGIN BlockOne -->
"I want to know what you think!"
<!-- END BlockOne -->
... so the wife says to her husband, {statement}.
and run this with the following code:
<?
$T->set_file('input_four', 'four.ihtml');
$T->set_block('BlockOne', 'BOne');
$T->parse('statement', 'BlockOne');
$T->set_var('BOne', '');
$T->pparse('Output', 'input_four');
?>
You'll note that the block of text gets put in the right place! Also note this line:
$T->set_var('BOne', '');
which clears out the BOne variable. This may or may not be necessary depending on how you have PHPLIB configured to run by default.