rejetto forum

Software => HFS ~ HTTP File Server => HTML & templates => Topic started by: rejetto on March 09, 2009, 11:50:31 PM

Title: template macros: true and false
Post by: rejetto on March 09, 2009, 11:50:31 PM
this is only for those who uses macros.

at the moment only the empty string and the zero string is considered to be "false".
any other value is true, as stated in the documentation (http://www.rejetto.com/wiki/index.php/HFS:_Template_macros#Logic_and_flow).

i think that the zero value should not be just "0", but also "0.0" in case of non-integers, or "0000".
at the moment this is not.
but from next build any numeric value equal to zero will fit.
Title: Re: template macros: true and false
Post by: Mars on March 10, 2009, 02:58:26 PM
juste missing the word 'false'  ;)

function isFalse(s:string):boolean;
  begin result:=(s='') or (strToFloatDef(s,1) = 0) or (lowercase(trim(s)='false') end;
Title: Re: template macros: true and false
Post by: rejetto on March 11, 2009, 10:56:32 AM
so why not the word "no" ? ;)
and "off" ? it would fit as well.

i'm just trying to keep it "low", because more values we have, more confusion can bring.
Title: Re: template macros: true and false
Post by: bacter on March 11, 2009, 05:35:23 PM
I think it's a good solution to use 0 and 0.0.

If words like false,no,off,nothing should be used, it would be better tu use a macro {.clear|varname.} , someting that can be done in [special:alias]: set to 0 !