From: Alex Teslik <[EMAIL PROTECTED]>
>Is there a switch (feature request?) that will tell HTMLTMPL to replace a
>TMPL followed by [\n\r]+ with nothing - even better replace the whole line if
>the only thing on the line is a TMPL tag? 

I raised this issue a year or two ago and it wasn't well-received. It seems 
like it's common for newcomers (as I was) to spot this and believe it's a 
shortcoming in H::T. Among experienced users, they believe it's easier and 
faster to use the "filter" option to strip *all* linefeeds if wasted bandwidth 
is your motivation to remove some. If the performance overhead of using the 
"filter" option is a concern, then preprocess your templates to load, filter 
and output them to another file which will be your template to be used at 
run-time. 

I do this for other reasons, like if there is common processing to be applied 
to parts of the page once. For example: international language substitution of 
headings, labels, etc. I use tags prefixed as "PREPROC-" in my *master* 
template to differentiate things that need to be preprocessed versus the tags 
that are dynamically set at run time. I use a batch script to load the template 
and "filter" the TMPL- tags to "HOLD-" tags, change the "PREPROC-" tags to 
"TMPL-" tags. I don't strip the linefeeds in this filter. I do my preprocessing 
to set TMPL-VARS and LOOPS as necessary for one-time initialization of the page 
(for example, language substitution). I output the H::T object to a variable 
and perform a regex on the variable to change all the "HOLD-" tags to "TMPL-" 
tags. This is where I strip the linefeeds. Then print this variable to a file 
which will be the template used at runtime. So, I have a master template (with 
includes, etc.) and a run-time template that needs no run-time processing 
except the actual variables that can change at run time (messages, dynamically 
generated lists, etc.).

That's probably a much more complicated example than what you need just to 
strip linefeeds. The filter option will work for you. I just wanted to 
demonstrate that there's a lot of ways to solve a problem with H::T if you 
realize you're not stuck with just one preconceived way to use it. It took me 
awhile to get that through my head. In the end I agreed that it's superior to 
use features like I described above than to burden H::T with indicators about 
what is essentially formatting (retention or removal).

Hope that helps.

Mark


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642
_______________________________________________
Html-template-users mailing list
Html-template-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/html-template-users

Reply via email to