Fire up your applications with Jetfire
RSS
Jetfire Wiki


Quick Search
»
Advanced Search »

Templates

The templating feature of Jetfire supports the dynamic creation of code. This feature is significantly more advanced and easier to use than C# generics or C++ templates.

Jetfire templating is totally generic. It can be used to generate Jetfire code or any other text based source code (eg HTML, JavaScript, C#, etc).


Template Method Rules

  • Template instructions may only be placed in a 'Template' method.
  • A Template method is defined as follows:
    • Has return type of string.
    • Returns the variable 'value'.
    • Contains 1 or more template instructions.
    • The method may have parameters.
  • A Template instruction is a source code line that begins with '##' or '#+#'.
    • Use '##' to generate a template line with a new line string at the end of the line.
    • Use '#+#' to generate a template line with no new line string.
    • The 'Template' source line must be terminated by a new line character.
  • Any Jetfire variable may be placed in a Template instruction bracketed by dollar signs ('$').
    • Jetfire variables will be resolved to strings when the Template method is executed.

Template Example

                namespace JetfireApps
                {
                 public workflow MyFlow
                 {
                    ArrayList list = new ArrayList();
                    public MyFlow()
                    {
                       list.Add(""One"");
                       list.Add(""Two"");
                       list.Add(""Three"");
                    }
                    public string TemplateTest()
                    {
                        ## the first line
                        foreach (string s in list)
                        {
                            ## $s$
                        }
                        return value;
                    } 
                 }
The 'Template' method 'TemplateTest()' when executed will return a string with the following value:
 the first line
 One
 Two
 Three

See Also

First Class Constructs
Jetfire Overview

ScrewTurn Wiki version 3.0.4.560. Some of the icons created by FamFamFam.