Re: [htmltmpl] TMPL_IF truth vs definition
Brought to you by:
samtregar
From: Stefan S. <ni...@de...> - 2002-06-21 18:45:25
|
> I'm taking a short cut by never exporting a boolean. I'm working on the >model if the data exists, then include this HTML with the output. So if >the conditions are never met (say, a table of people matching a >criteria, but there happen to be none), I never set that variable, and >therefore I don't want the associated HTML out there. > > Right now I'd have to stick in a bunch of extra lines to do my_var_bool >=> 1 wherever I have a my_var => $x in case if ($x) is false. > > TMPL_IF works all of the time except when the data that exists just >happens to be 0 (or anything else that is false). > > > I was first sceptical about this when reading but there is one argument why something like a TMPL_IFDEF might have some sense: I think it would be better for keeping presentation and programm seperated. Currently you have to do something in your script (creating these boolean variables) just to support the presentation which should be done by a different layer (templates). Stefan "Nine" Seifert |