Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.3.13

Bug #90 Whitespace Trailing Substitution Eaten
Submitted: 2003-10-13 02:04 UTC
From: mitch at enetis dot net Assigned:
Status: Wont fix Package: HTML_Template_Flexy
PHP Version: 4.3.3 OS: debian linux
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 43 + 13 = ?

 
 [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

Comments

 [2003-10-13 02:18 UTC] alan_k
It's a known oddity of the php engine - it strips CR/LF following the ?> Normally for emails, I'm tempted to recommend the regex parser - $x = new HTML_Template_Flexy(array( 'compiler'=>'Regex', 'filters' => array('SimpleTags', 'mail'), )); As it wont try and parse 'alan <alan@example.com>' as html.. = and also has the fix for CR/LF adding..
 [2003-10-13 08:44 UTC] alan_k
Work around: add a space after the } of a flexy tag.. The PHP issue is echo -e "<?php echo 'hello'; ?>\nWorld" | php prints helloWorld - removing the \n.. since flexy converts {xxx}\n into <?php echo $t->xxx; ?>\n PHP is probably the guilty party here:) I didnt really want second guess PHP.. here.. :) - I guess this gets a wontfix :)
 [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 ,.