RE: [PHP] stripping white space?
| From: | Brian White | Date: | Tue, 10 Jul 2001 23:07:57 +0000 |
| Subject: | RE: [PHP] stripping white space? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-57260@lists.php.net to get a copy of this message | ||
You just gotta love religious wars.....
How many people know about SGML? HTML is a standard implemented in SGML, and
so has many of the possible features of SGML which got excluded for XML such as
* ommissible end tags
* optional quotes on attribute values that don't contain spaces or quotes
* implied attribute values
* ommissible attribute names ( eg for things like "checked" )
Anyway. Not wading in to the debate. Just making an observation....
At 02:20 10/07/2001 -0500, Navid A. Yar wrote:
I guess this is just one of those things where everyone's opinions runs in different directions, yet everyone is entitled to their own. I myself try to respect the standard because of the browser war years which made everyone uncomfortable. Now most browsers are trying to merge into a single standard (thank god). I believe the future to be XML, and I also don't think HTML will ever go away. However, I do believe that HTML will be treated more strict (hence the emergence of XHTML which is based on HTML 4.0 and XML). My suggestion to everyone is to continue using standards and try not to go astray from them, else we know the headaches us developers can face in the future. Sincerely,------------------------- Brian White Step Two Designs Pty Ltd - SGML, XML & HTML Consultancy Phone: +612-93197901 Web: http://www.steptwo.com.au/ Email: bwhite@steptwo.com.auNavid Yar-----Original Message----- From: Maxim Maletsky [mailto:maxim@japaninc.com] Sent: Tuesday, July 10, 2001 1:06 AM To: 'NavidYar2@home.com'; php-general@lists.php.net Subject: RE: [PHP] stripping white space? Yeah, I know that XML requires it. And I also know that it is not a good code practice, but it perfectly works for HTML pages. Browsers compatible with the style sheets have no problems with this code (there's no connection), and if there's any XML to work on the HTML will be rewritten anyway, so there's really no reason to worry about it. Just the size gets lower and typing (escaping in PHP) is easier. I think it IS a good practice if you only practicing HTML to be outputted by PHP. Sincerely, Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) maxim@phpbeginner.com www.phpbeginner.com -----Original Message----- From: Navid A. Yar [mailto:NavidYar2@home.com] Sent: Tuesday, July 10, 2001 2:40 PM To: php-general@lists.php.net Subject: RE: [PHP] stripping white space? If you do this then those who will want to eventually convert their projects over to XML or XHTML format will have a hard time doing so, because the double quotes around the values of the attributes are required. Also, it's not good code practice. Just something for future reference... -----Original Message----- From: Maxim Maletsky [mailto:maxim@japaninc.com] Sent: Tuesday, July 10, 2001 12:16 AM To: 'mukulsabharwal@yahoo.com'; Kurt Lieber; php-general@lists.php.net Subject: RE: [PHP] stripping white space? I would not be stripping white spaces, but double white spaces into single ' '; for example: $html = ereg_replace("[[:space:]]+", ' ', $page); I never tested this, but what I am trying to do is to get all and any blank characters and replace them with one single space. Why? Because I don't want all the words in text to merge together. This should reduce the size. Also here's a tip: remove any double or single quotes in tags surrounding integers. This is compatible enough, but is a bunch of bytes. i.e.: change every <IMG SRC="/img/arrow.gif" WIDTH="12" HEIGHT="11" BORDER="0" ALT="arrow" align="left"> to <IMG SRC="/img/arrow.gif" WIDTH=12 HEIGHT=11 BORDER=0 ALT="arrow" align="left"> this example is reduced by 6 bytes. Sincerely, Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) maxim@phpbeginner.com www.phpbeginner.com -----Original Message----- From: Mukul Sabharwal [mailto:mukulsabharwal@yahoo.com] Sent: Tuesday, July 10, 2001 2:05 PM To: Kurt Lieber; php-general@lists.php.net Subject: Re: [PHP] stripping white space? Hi, I take that you simply want to remove ALL whitespaces from a data block (variable). you could simply use str_replace(" ", "", $var); --- Kurt Lieber <php@internalcombustion.com> wrote: Is there a way using PHP to easily strip white space out of an html page as it's being sent to the client. That is to say, the page that we as developers work on is nicely formatted, indented, etc. but when it's sent out to the client, PHP will remove all the extra white space both to obfuscate the code and reduce the size a bit. For anyone who knows Cold Fusion, I'm looking for the PHP equivalent of the "Suppress whitespace by default" option in the Cold Fusion Server Administrator. (NOTE: I'm not looking for a discussion on the merits of stripping vs. not stripping white space characters or whether or not it really does any good -- I just want to know if it can be done easily using PHP) Thanks. --kurt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net ===== ********************************* http://www.geocities.com/mimodit ********************************* __________________________________________________ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail http://personal.mail.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net