Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

End of Line - issue

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Smarty Development
View previous topic :: View next topic  
Author Message
bimal
Smarty Elite


Joined: 19 Apr 2007
Posts: 423

PostPosted: Mon Jan 02, 2012 10:16 am    Post subject: End of Line - issue Reply with quote

I think, we solved the issue of - appearing an empty line in the end of closing PHP tag in the compiled output. It was the issue in 2.x version.

I am using Smarty 3.x and still saw this. For example, when I write the tag like:
Code:
<tr class="{cycle values='A,B'}">


It gives the following lines:
Code:
<tr class="<?php echo smarty_function_cycle(array('values'=>'A,B'),$_smarty_tpl);?>
">


While the intended output should be:
Code:
<tr class="<?php echo smarty_function_cycle(array('values'=>'A,B'),$_smarty_tpl);?>">


Please note that right after before the end of the quotation mark for class="", there is an empty line. Due to the parsing nature of PHP for immediate empty lines, it is not a bug to me. The final HTML appears as I intend.

Just, "> appears in the next line.

But you guys may think of removing that empty line.
Back to top
View user's profile Send private message Visit poster's website
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Mon Jan 02, 2012 5:33 pm    Post subject: Reply with quote

PHP eats that newline so that the html output is as it should be <tr class="A">.

The newline after closing PHP tag is needed because other cases won't work.

Code:
{$foo}
{$bar}


Must compile to
Code:
<?php echo $_smarty_tpl->tpl_vars['foo']->value;?>

<?php echo $_smarty_tpl->tpl_vars['bar']->value;?>


Otherwise you will get wrong result.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Smarty Development All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP