Would it be possible to to add another level of cache? So that my templates are still dynamic but everything discussed here is taken into account.
Just take all code not surrounded by php blocks and shove them into an echo, taking into consideration that you could append instead of a new echo. Then remove all ?><?php occurrences. Not so much a cache, but a one time optimization to make every future run be faster, even if only by a bit. I would gladly let symfony pre process my files once (per change) to get a 20% increase on every future page load. Mark. On Jan 26, 9:30 am, "colnector (colnect.com)" <[email protected]> wrote: > The questions also appear > on:http://www.symfony-project.org/forum/index.php/m/70751/#msg_70751 > andhttp://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 -~----------~----~----~----~------~----~------~--~---
