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 #9783

some words between "{" and "}" are missing displayed!

Details

Submitted2007-01-09 11:23 UTC
Fromustc_frank at sina dot com
Assigneddsp
StatusClosed
PackageHTML_Template_IT
PHP Version4.3.11
OSWINDOW XP
Roadmaps1.3.0a1

Comments

[2007-01-09 11:23 UTC] ustc_frank at sina dot com

Description:
------------
some words between "{" and "}" are missing displayed!

Test script:
---------------
<?php
require_once 'HTML/Template/IT.php';

$data = array (
'0' => array('Stig', '{Bakken}'), // Bug Here: The words between "{" and "}" is MISSING!
'1' => array('Martin', 'Jansen'),
'2' => array('Alexander', 'Merz')
);

$tpl = new HTML_Template_IT('./templates');
$tpl->loadTemplatefile('main.tpl.htm', true, true);

foreach ($data as $name) {
foreach ($name as $cell) {
// Assign data to the inner block
$tpl->setCurrentBlock('cell');
$tpl->setVariable('DATA', $cell); // Bug Here: The words between "{" and "}" DO NOT be displayed!
$tpl->parseCurrentBlock();
}
// Assign data and the inner block to the
// outer block
$tpl->setCurrentBlock('row');
$tpl->parseCurrentBlock();
}
// print the output
$tpl->show();

// output:
/*
Stig // Bug Here: The word "Bakken" MISSING!
Martin Jansen
Alexander Merz
*/
?>

Expected result:
----------------
Stig {Bakken}
Martin Jansen
Alexander Merz

Actual result:
--------------
Stig
Martin Jansen
Alexander Merz

[2007-01-11 14:06 UTC] aa1 at addihome dot org

As a work-around, you can use this before your setVariable:
$cell = strtr($cell, '{}', ' ');
or if you really want the brackets:
$cell = addcslashes($cell, '}');

[2007-02-01 17:32 UTC] dsp at php dot net

This bug has been fixed in CVS.

If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET).

If this was a problem with the pear.php.net website, the change should be live shortly.

Otherwise, the fix will appear in the package's next release.

Thank you for the report and for helping us make PEAR better.