Home » HTML » HTML_Template_IT » Bug #2833
addBlockFile() bad Parameters documentation info
Details
| Submitted | 2004-11-26 09:30 UTC |
|---|---|
| From | solkar dot saruman at gmail dot com |
| Assigned | dsp |
| Status | Closed |
| Package | HTML_Template_IT |
| PHP Version | 5.0.2 |
| OS | Windows |
| Roadmaps | (Not assigned) |
Comments
[2004-11-26 09:30 UTC] solkar dot saruman at gmail dot com
Description:
------------
This is the actual info about addBlockFile Parameters:
"Adds a block taken from a file to the template changing a variable placeholder to a block placeholder.
Parameters:
string $placeholder — Name of the variable placeholder to be converted
string $blockname — Name of the block to be added
string $filename — File that contains the block"
The $blockname parameter must have a filename prefix, like this:
$blockname => 'filename_blockname'
Reproduce code:
---------------
//This Doesn't Work, Blockname is 'FAILMAIN' and it's an empty block
$template->addBlockfile('BLOCK2','FAILMAIN','failure_menu.tpl');
$template->touchBlock('FAILMAIN');
$template->parseCurrentBlock('FAILMAIN');
//This Works Great!!
$template->addBlockfile('BLOCK2','failure_menu_FAILMAIN','failure_menu.tpl');
$template->touchBlock('FAILMAIN');
$template->parseCurrentBlock('FAILMAIN');
[2006-07-11 19:11 UTC] dsp at php dot net
Thank you for taking the time to write to us, but this is not
a bug.
addBlockFile creates a block from the content of a file, thats what "adds a block taken from a file" means. The added block is named $blockname.
So the added template block will look like
<snip>
<!-- BEGIN $blockname -->
my file content with block FAILME
<!-- BEGIN FAILMAIN -->foo<!-- END FAILMAIN -->
<!-- END $blockname -->
</snip>
So given $blockname must differ from FAILMAIN to access FAILMAIN. Thats why the second solution works.