The questions also appear on:
http://www.symfony-project.org/forum/index.php/m/70751/#msg_70751
and
http://www.symfony-project.org/forum/index.php/t/18496/

Symfony templates are simple HTML embedded with PHP in them.
For this reason they present the following downsides:
* An extra amount of unneeded whitespace exists. Since you'd prefer to
have a readable file, you organize it nicely. However, the generates
files are needlessly bigger.
* There's a price for PHP going in and out of scripting mode by using
<?php and later ?>.
* There's a price for calling PHP's echo again and again instead of
once.

Though these prices may be negligible for some sites, I feel they are
becoming more and more costly for dynamic sites. Also, the template is
not that readable with <?php and ?> cluttering it everywhere.

Your opinions / insights are welcomed.

Here's a sample of two alternative:

Symfony style:

<ul>
  <li><?php echo link_to('1', 'module/action');?></li>
  <li><?php echo link_to('2', 'module/action');?></li>
  <li><?php echo link_to('3', 'module/action');?></li>
  <li><?php echo link_to('4', 'module/action');?></li>
  <li><?php echo link_to('5', 'module/action');?></li>
  <li><?php echo link_to('6', 'module/action');?></li>
</ul>



A more optimized PHP script could be:

<?php echo '<ul><li>'
    .link_to('1', 'module/action')
    .'</li><li>'
    .link_to('2', 'module/action')
    .'</li><li>'
    .link_to('3', 'module/action')
    .'</li><li>'
    .link_to('4', 'module/action')
    .'</li><li>'
    .link_to('5', 'module/action')
    .'</li><li>'
    .link_to('6', 'module/action')
    .'</li></ul>'
    ;



The second script, although looks less like HTML, produces a
whitespace-free output, uses a single echo command and doesn't force
PHP's parser to go back and forth. Of course in this small example the
differences are meaningless but I hope you understand my point.

Your opinions / insights are welcomed.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/symfony-devs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to