Re: [htmltmpl] Whitespace (linefeed) suppression?
Brought to you by:
samtregar
From: Pete P. <pet...@cy...> - 2004-05-12 13:44:57
|
petersm wrote: > Mark Fuller wrote: > > >>If I have something like this for readability in the template: >> >>============================== >><TMPL_IF NAME="ERRMSG"> >> >> <p>Error: <TMPL_VAR NAME=ERRMSG> >> >> <TMPL_IF NAME="EMAIL_AVAILABLE"> >> >> (Forgot your password? <a href="">Reset and email it to yourself</a>.) >> >> </TMPL_IF> >> >> </p> >> >></TMPL_IF> >>================================ >> >>The resulting HTML has a lot of newlines. >> >>I'd like to ask if there should'nt be a feature in H::T that would let the >>template author selectively disable "rendering" linefeeds as meaningful >>(intended) whitespace? What I am suggesting is an attribute for TMPL_IF (and >>other operations?) named "NOLF" that would cause H::T to discard linefeeds? > > > Why should this matter (besides the bandwidth issue)? HTML ignores whitespace > and other than looking at the output of a template every now and then to make > sure that it is what you want, why do you care what the output looks like? > > I like the fact that it does exactly what you tell it to do. If you have > whitespace it puts it in your loop. If you don't have whitespace it won't. > Fairly intuitive to me. Anyone? Ah, this reminds me of when I had to use ColdFusion, and the code was producing *hundreds* and *hundreds* of lines of whitespace (I think this was a v4.5 issue that was later somewhat 'fixed') Anyway, bandwidth became a huge issue, as the pages were pretty hefty to begin with. It sounds like a feature that may be useful to some where every kbyte and second really matter. Pete |