All posts by Phill Smith

USER_FUNCTION, FX

[USER_FUNCTION:function_name|parameters(php style)]] aka FX Construct user defined function. Terminate with: [[END_FUNCTION]] or [[END_FX]] To call: [[FUNCTION:function_name|result|function_parameters(php style)]] Code to execute the user defined function using the parameters and return the result to the variable name specified as the second parameter in the shortcode. see also: [[RETURN:value]]

FOR_EACH_AS

[[FOR_EACH_AS:listname|item]] Interates through the list and places each value into the variable whose name is designated by the item parameter value. The following statements are executed before [[END_FOR_EACH_AS]] for each item in the list. A list is equivalent to a single dimension indexed array in PHP. Example: [[FOR_EACH_AS:studentlist|name]] [[PRINT:name]][cr] [[END_FOR_EACH_AS]] Outputs the student list one… Read More »

IF

[[IF:Boolean]] Executes until  [[ELSE]] , [[ELSE_IF]] or [[END_IF]] is encountered in the code if Boolean condition is true Usage examples.: [[IF:$a==$b]] [[IF:$status===TRUE]] [[IF:$status]] [[IF:((($a==$b)AND($b>=$c))OR(($a==$b)AND($b<=$c)))]] [[IF:((($fname==”John”)&&($age>=21))||(($lname==”Smith”)&&($age<=111)&&($age>18)))]] You’ll see these same operators in many dynamically typed languages, not just TerraDctl Script. See PHP Operators. ==  convert  into types it can compare. Really equal. ===  compare with respect… Read More »

WHILE

[[WHILE:phpboolean]] Loop through the following statements before [[END_WHILE]] repeating while condition is true.   Example: [[INITIALIZE:counter|1]] [[WHILE:$counter<=10]] [[PRINT:counter]][[cr]] [[INCREMENT:counter]] [[END_WHILE]]   Outputs the number 1 through 10, one number per line.   See also WHILE_SMALLER, WHILE_SMALLER_OR_EQUAL.