Re: [SMARTY] HTML cruncher & protection

From: Date: Sat, 19 Jun 2004 03:33:49 +0000
Subject: Re: [SMARTY] HTML cruncher & protection
References: 1 2  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-11479@lists.php.net to get a copy of this message
Robert Cummings wrote:
On Fri, 2004-06-18 at 20:07, Sam Saltis wrote:
Does anyone have a script that allows you to crunch smarty pages (removing all necessary spaces, carriage returns and line breaks) making the page a single string. Helping make the page hard to read and secondly faster to load?
While it may make the page a teency bit faster any half decent HTML parser will be able to easily parse it all back into a very readable tree. Cheers, Rob.
I agree. Crunching HTML provides no protection at all, and just makes pages harder to debug. As well, page load bottlenecks tend not to be in the whitespace, but in the images and often in bad HTML (i.e. the crud which gets thrown into the page by so many HTML editors. Ensuring that the HTML is tightly written and doesn't use extra codes, avoiding the use of <font> etc, and appropriate use of tags can all make more of a difference. I'm not saying you won't see a speedup--but there are usually other places to look which will provide a bigger benefit first, and then move on to the whitespace. That said, see if any of these options suits your needs: The Smarty 'strip' built-in function: http://smarty.php.net/manual/en/language.function.strip.php A couple of other whitespace/comment strippers (I have not used these): http://smarty.incutio.com/?page=SmartyTips One tool you can use to analyze your pages is located at http://www.websiteoptimization.com/ (I am not affiliated with these guys; I just use the link provided by Firefox's Web Developer Toolbar to evaluate some pages). It will give you some pointers on what you can usefully do to help transmission times. Another tool you can use if your ISP supports it is mod_gzip, which compresses page output when sending it to the browser--however, this will not work on very old browsers, and can be problematic on Netscape 4, IE 5, and Opera 4 and earlier versions. Check out http://www.schroepl.net/projekte/mod_gzip/ for more information. It can significantly improve text download times. Hope this helps, Torben -- Torben Wilson <torben@php.net>

« previous php.smarty.general (#11479) next »