Lots of people are looking at ways to optimize symfony but one simple way that seems to have been over looked is a method described in the following article:
http://developer.yahoo.com/performance/rules.html In the article the writer describes the benefits of including css in the head of the html and all js before the closing body tag. I'm not sure peoples thoughts on this? I understand that it is perfectly possible to write your own sfCommonFilter.class.php that will move the location of the includes. But I do feel that this is a very simple modification that will improve the page rendering especially if developers also combine and minify their css and jss files. Here is my suggested modifications to the sfCommonFilter.class.php <?php /* * This file is part of the symfony package. * (c) 2004-2006 Fabien Potencier <[EMAIL PROTECTED] project.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ /** * sfCommonFilter automatically adds javascripts and stylesheets information in the sfResponse content. * * @package symfony * @subpackage filter * @author Fabien Potencier <[EMAIL PROTECTED]> * @version SVN: $Id: sfCommonFilter.class.php 4593 2007-07-13 11:47:43Z fabien $ */ class sfCommonFilter extends sfFilter { /** * Executes this filter. * * @param sfFilterChain A sfFilterChain instance */ public function execute($filterChain) { // execute next filter $filterChain->execute(); // execute this filter only once $response = $this->context->getResponse(); sfLoader::loadHelpers(array('Tag', 'Asset')); // include stylesheets $content = $response->getContent(); if (false !== ($headPos = strpos($content, '</head>'))) { $cssHtml = ''; if (!$response->getParameter('stylesheets_included', false, 'symfony/view/asset')) { $cssHtml = get_stylesheets($response); } // Place the CSS tags before the closing </head> tag if ($cssHtml) { $response->setContent(substr($content, 0, $headPos). $cssHtml.substr($content, $headPos)); } } // include javascripts $content = $response->getContent(); if (false !== ($bodyPos = strpos($content, '</body>'))) { $jsHtml = ''; if (!$response->getParameter('javascripts_included', false, 'symfony/view/asset')) { $jsHtml = get_javascripts($response); } // Place the JS tags before the closing </body> tag if ($jsHtml) { $response->setContent(substr($content, 0, $bodyPos). $jsHtml.substr($content, $bodyPos)); } } $response->setParameter('javascripts_included', false, 'symfony/ view/asset'); $response->setParameter('stylesheets_included', false, 'symfony/ view/asset'); } } Thanks Alistair --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
