Thank you all for your insights. On my website I'm already using APC,
Symfony's cache and mod_gzip.

Mostly an extra space or another <?php ?> block is completely
negligible. However, sometimes pages becomes heavy (for example, a
user on my site may see the following list including 250 items:
http://coins.colnect.com/en/coins/list/country/2504). In such cases, I
believe the issues I've mentioned need be considered. Also, my site is
highly dynamic so I cannot cache the really heavy pages (since each
collector sees the page differently based on his personal collection
which can change on any click he/she does).

Yes, hardware is getting cheaper and cheaper and code is getting more
and more bloated.

About readability, I actually have a big problem with Symfony's way of
adding more <?php ?> blocks. Obviously the example I've included
didn't demonstrate if but if we add a few IFs and FORs, then consider
these two:

Symfony style:
<?php if (true && do_some_function(array(1, 3, $var), $stuff)) : ?>
<ul>
  <?php foreach($myArray as $item) : ?>
     <li><?php echo link_to($item['display_name'],
myClass::getItemDisplayModule($item).'/action',
                array('class' => 'some_css_class', 'whatever' =>
'gever')); ?></li>
  <?php endforeach; ?>
</ul>
<?php endif; ?>

A more optimized PHP script could be:

<?php if (true && do_some_function(array(1, 3, $var), $stuff)) {
  echo '<ul>';
  foreach($myArray as $item) {
    echo '<li>'
       .link_to($item['display_name'], myClass::getItemDisplayModule
($item).'/action',
          array('class' => 'some_css_class', 'whatever' => 'gever'))
       .'</li>';
  }
  echo '</ul>';
} ?>


Do you still find the first example more readable?
--~--~---------~--~----~------------~-------~--~----~
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