PEAR is archived and read-only

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

Home » HTML » HTML_Template_Flexy » Bug #90

Whitespace Trailing Substitution Eaten

Details

Submitted2003-10-13 02:04 UTC
Frommitch at enetis dot net
StatusWont fix
PackageHTML_Template_Flexy
PHP Version4.3.3
OSdebian linux
Roadmaps(Not assigned)

Comments

[2003-10-13 02:04 UTC] mitch at enetis dot net

Description:
------------
Newlines following a {variable} disappear after substitution.

This is not a big deal when generating HTML, obviously, but one sees it
if one is using a template to make plain text, such as for an email.

Use the following two lines for template.text in the reproduce code:

W{foo}
{bar}Z

Later,
- Mitch

Reproduce code:
---------------
<?
require_once 'HTML/Template/Flexy.php';

$obj = new StdClass;
$obj->foo = 'X';
$obj->bar = 'Y';

$options = array('templateDir' => '.',
'compileDir' => '.',
'compiler' => 'Standard');

$output = new HTML_Template_Flexy($options);
$output->compile('template.text');
$output->outputObject($obj);
?>

Expected result:
----------------
WX
YZ

Actual result:
--------------
WXYZ

[2004-11-11 05:09 UTC] john at curioussymbols dot com

(1) You need to use capital 'm' in 'mail' as follows:

$x = new HTML_Template_Flexy(array(
'compiler'=>'Regex',
'filters' => array('SimpleTags', 'Mail'),
));

(2) This Regex/SimpleTags/Mail compiler gives funny output, and I end up with blanks going in to my template:

Template:
---------
I am interested in purchasing your {producttypename} named {productname},

Compiled Template:
------------------
I am interested in purchasing your <?=htmlspecialchars(@$producttypename)?> named <?=htmlspecialchars(@$productname)?>,

Output:
-------
I am interested in purchasing your named ,.