PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » HTML » HTML_Template_IT » Bug #2833

addBlockFile() bad Parameters documentation info

Details

Submitted2004-11-26 09:30 UTC
Fromsolkar dot saruman at gmail dot com
Assigneddsp
StatusClosed
PackageHTML_Template_IT
PHP Version5.0.2
OSWindows
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.