]> WPIA git - gigi.git/blob - doc/TemplateSyntax.txt
ADD: If-else documentation
[gigi.git] / doc / TemplateSyntax.txt
1 A template is constructed from a charstream. Everything that is not in "<?" to "?>" will be outputted directly. Text in these markers will be interpreted is template scripting syntax. The following strings are valid:
2
3 - <?=$variblename?> will output "variablename".
4    if "variablename" is an Outputable output this thing recursively.
5    else turn it into a String (Object.toString()) and output it.
6    
7 - <?=_This is free Text.?> will translate "This is free Text." into the users language, (escaped) and output it.
8    
9 - <?=s,$var1,$var2,$var3,...,$varn,This %s is, %s free.?>
10   Translate the last string. Output $var1,...,$varn replaced into the %s positions in the translated string.
11
12 - <?=$!variablename?> will output the variable "variablename" but not HTML-escaped
13 - <?=s,$!variablename,My %s text?> will insert the variable "variablename" into the translated text but not HTML-escaped
14 - <?=s,"some data",My %s text?> will insert "some data" into the translated text
15 - <?=s,!"some data",My %s text?> will insert "some data" into the translated text literally (not HTML-escaped)
16   
17 - <? if($variable) { ?> ... <? } ?>
18   Output/execute the text until "<? } ?>" only if $variable is Boolean.TRUE (<=> !Boolean.FALSE) or not null. 
19 - <? if(...) { ?> ... <? } else { ?> ... <? } ?>
20
21 - <? foreach($variable) { ?> ... <? } ?>
22   If $variable is an "IterableDataset"
23   Output/execute the text until "<? } ?>" repeated as $variable suggests. 
24   Special variables that $variable defines can be used in the inner text.
25  
26   
27