Re: Re: Reducing size of htm output
| From: | M. Sokolewicz | Date: | Sat, 07 May 2005 21:57:18 +0000 |
| Subject: | Re: Re: Reducing size of htm output | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-214678@lists.php.net to get a copy of this message | ||
Seems I'm going a bit too far here :)
The URL quotes which states to denote JS between <!-- --> comment tags is from the HTML 4.0 page. I've been reading lots of XHTML recommendations lately, and have become accustomed to those. In those, when a <script> isn't understood, it's ignored. Besides that fact, it should also be denoted by the CDATA
tags
<![CDATA[ ...//... ]]>
sorry about making such a fuss of it around here ;) (just personally don't like it either)
Rory Browne wrote:
excuse me? since when is this considered /good/ practice??? It's one of those things that are concidered /bad/ practice according to w3...Hmmm, didn't know the w3c had an opinion on the usage of <!-- //--> tags to delimit javascript. I've always been recommended to use them, to hide the script from browsers that don't support javascript, just like I use <noscript>, or <noframes> to show messages to browsers that don't support script or frames. Can you reference the message/memo/whatever from the w3c that discourages them. I believe perhaps you took either it or my suggestion out of context, because I can't fathom a reason why you wouldn't want to hide js from non-js-capable browsers.andyou have the additional talk of replacing out // and /* .. */ comments. but if you really want to do it then: function ob_whitespace_removal($str){ // would need to dbl_check regex/modifiers return ob_gzhandler(preg_replace("/\s+/m", " ", $str)); } should work, Although for purists/modularity output buffer stacking may be a cleaner technique Re: Internet Explorer Problems: if you check the ob_start or ob_gzhandler pages on the php manual(online version) then you'll find a user-submitted comment saying that MSIE doesn't cache compressed stuff. This doesn't matter for a dynamic website. Try googling, but don't say ob_gzhandler, since this is (allegedly) a problem with IE/gzip compatability, and not the ob_gzhandler implemention(ie search for gzip and not ob_gzhandler). On 5/7/05, Kirsten <neretlis@westnet.com.au> wrote:-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.phppreg_replace('/s+/', ' ', $html); but watch out, this js code will work: var v alert(v) this one will not: var v alert(v)Sure.... but now: how do I access the htm output of the current executing script before it is send to the user? Thanks againuser1) Is there any function to do this (I'm using PHP 4.2) ? Or maybe some5.5+?has already done it? 2) Is it true that ob_start("ob_gzhandler") can cause problems on IEdon't know. but you can detect these browsers and turn compression off-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php