|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
bimal Smarty Elite
Joined: 19 Apr 2007 Posts: 423
|
Posted: Mon Jan 02, 2012 10:16 am Post subject: End of Line - issue |
|
|
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 |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Mon Jan 02, 2012 5:33 pm Post subject: |
|
|
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.
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 |
|
|
|
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
|