Re: Re: Reducing size of htm output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.



and

you 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@xxxxxxxxxxxxxx> wrote:


preg_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 again



1) Is there any function to do this (I'm using PHP 4.2) ? Or maybe some

user


has already done it?
2) Is it true that ob_start("ob_gzhandler") can cause problems on IE

5.5+?


don'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


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux