[thelist] can whitespace be removed

Diane Soini dianesoini at earthlink.net
Sat Feb 21 17:09:20 CST 2004


Sorry for delay responding. It's an old topic now I'm sure.

> which code are you using?
Only apache SSI.


> May I ask why would you want to do that? (sorry for not being very 
> helpful,
> just curious...)
> Alvaro Medina G.

I would like to reduce the file size of my pages a little bit more. It 
can be amazing how much whitespace can increase your file size. Not 
that what I'm doing will make a dramatic difference, but I've seen a 
difference in some server-generated code where removing whitespace 
reduces file size more than half.

> check that the SSI isn't prefixed or suffixed with any tags that would
> insert breaks anyway
>
> or indeed that the SSI doesn't induce them as it does behave like 
> "real"
> HTML on the page
>
> FB
>
I'm not sure I understand "prefixed or suffixed". It's straight Apache 
SSI, and for my own sanity, when writing all the nested if/else and 
setting variables and all that, I prefer to keep the line breaks in. 
Here's an small example:

<!--#set var="qstr" value="$QUERY_STRING" -->
<!--#if expr="$qstr=/somestring/" -->
	<!--#set var="title" value="Some Title" -->
	<!--#set var="someothervar" value="/some/other/var" -->
<!--#elif expr="$qstr=/someotherstring/" -->
	<!--#set var="title" value="Some Other Title" -->
	<!--#set var="yetanothervar" value="/yet/another/var" -->
[etcetera for several lines...]
<!--#endif -->

There would most likely be a better way to do the above, however I have 
no PHP or anything fancy to use, and Apache SSI doesn't have many other 
structures besides this simple if/else structure, and I didn't want to 
have to write perl scripts...But that is not really my question. Even 
with other languages, such as JSP, and more elegant programming, you 
will still see line breaks left over after the code has been stripped.

Also, I don't want super crunched up, optimized code. I like my code to 
stay readable, but without all the empty lines.
> Hi Diane,
>
> It depends on the language and on the way it's implemented.
>
> For instance PHP removes all the empty lines that are between beginning
> "<?php" and ending "?>" tags -- as it should, since there's no output 
> by
> defaut in-between.
>

> -- 
> s t e f
> http://www.nota-bene.org/

Hey you are right! It does a fabulous job. Perhaps this is just the 
excuse to switch this little project over to a new web host. I've been 
considering doing that, but haven't really done anything about it.

I was just curious if there was something I had never heard of with 
Apache that might all me to do this specifically in my limited 
environment. If not, then I guess I'll look forward to moving up to PHP.

Thank you!

Diane
>
***
Don't be afraid to try something new. An amateur built the ark. 
Professionals built the Titanic. -unknown



More information about the thelist mailing list