106
HTML & templates / Macros
« on: December 08, 2007, 06:21:58 PM »
Some ideas of macro for the continuation
http://www.rejetto.com/wiki/index.php?title=HFS:_Template_macros
Quote
%symbols% : Text HFS symbols
%mysection% : HTML Text for compatibility with old templates
// Boolean must be TRUE or FALSE , nothing else
{{ not | Boolean | /not }} : Boolean result= not(Boolean)
{{ and | Boolean1 | Boolean2 | ... | BooleanN | /and }} : Boolean result= Boolean1 AND .... AND BooleanN
{{ or | Boolean1 | Boolean2 | /or }} : Boolean result= Boolean1 OR .... OR BooleanN
{{ xor | Boolean1 | Boolean2 | /xor }} : Boolean result= Boolean1 XOR Boolean2
{{ is == | Num1 | Num2 | /is }} : Boolean To be NEW
{{ is >= | Num1 | Num2 | /is }} : Boolean To be NEW
{{ is <= | num1 | Num2 | /is }} : Boolean To be NEW
{{ is <> | Num1 | Num2 | /is }} : Boolean To be NEW
{{ is >> | Num1 | Num2 | /is }} : Boolean To be NEW
{{ is << | Num1 | Num2 | /is }} : Boolean To be NEW
{{ is def | urlvar| /is }} : Boolean return TRUE if URLVAR is defined in url To be NEW
{{ is equal | Text1 | Text2 | /is }} : Boolean
{{ is empty | Text | /is} : Boolean To be NEW
{{ is substring | subText | Text | /is} : Boolean
{{file|name|url}} '' or a name To be NEW
{{file|size|url}} '' or >=0 To be NEW
{{file|date|url}} '' or a date To be NEW
{{file|empty|url}} true or false To be NEW
{{file|exist|url}} true or false To be NEW
{{if | Boolean | then | else | /if }} : Text
{{ if not | Boolean | then | else | /if }} : Text
{{ switch | What | Text1 | Result1 | Text2 | Result2 | .... | TextN | ResultN_ as_Default | /switch }} : Text
{{ pos | subText | Text }} : Num To be NEW
{{ length | Text }} : Num
{{abs| value}} Abs Returns the absolute value of a signed number
{{max| value1 | value2 |...| valueN }} Max Gives the maximum of some integer values
{{max| value1 | value2 |...| valueN }} Min Gives the minimum of some integer values
{{calc | numerical expression to be evaluated }}
syntax:
{{calc | num1 | + | num2 | - | ( | num3 | / | num4 | ) | * | -num5 }} or
{{calc |num1+num2-(num3/num4)*(-num5) }}
{{ left | Text | Num }} : Text To be NEW
{{ right | Text | Num }} : Text To be NEW
{{ mid | Text | Num-From | Num-Upto }} : Text To be NEW
{{ upper | Text }} : Text
{{ lower | Text }} : Text
{{ trim | Text }} :Text
{{ repeat | Num | Text }} : Text
{{ substring | From-After-Text | To-Before-Text | Text-Source }} : Text
{{ cut | Num-From(begin) | Num-Upto(end) | Text }} :Text
{{ replace | Text-Old | Text-New | Text-Source }}
{{ chopline | Num | Text-Source}} : HTML Text To be NEW
{{ section | mysection }} : HTML Text load section from active template
(included "diff template" and hfs.diff.tpl) idem as %[mysection]%
{{ section | mysection | external_file}} : HTML Text load mysection from external template
{{load | external_file}} : HTML Text
{{load | external_file | from-line | Upto-line }} : HTML Text To be NEW
{{translate|text}} translate any text to UTF-8 To be NEW
{{alias| name | html-text}} call by {{$name}} To be NEW
return html-text can be use as variable
{{inc | $name | value }} To be NEW
{{dec| $name | value }} To be NEW
at the place of {{alias|name|{{calc|{{$name}}+ value}} }}
{{define | newmacro | {{macro|$1|$2|$3|....}} }} To be NEW
call by {{newmacro| param1|param2|.....}}
http://www.rejetto.com/wiki/index.php?title=HFS:_Template_macros