The code generator processes the following template tags inside the templates to generate the working codes, intermediate or advanced users can make use of these tags to create custom templates. These tags are case-insensitive. All template tags have the same basic syntax:
Due to the HTML comment style format, these script blocks will be treated as HTML comments in any editors. Therefore, you can use your favorite editor to edit the template provided that these special tags are kept in place.
It is important to understand how templates tags works. If you know how ASP works, you know how template work as they work in the same way. During code generation, the code generator reads the template file, executes the scripts in the template tags, and finally, write the codes to the output file, like ASP outputs HTML to browser.
There are 6 types of template tags, the last 3 are just special cases of the 3rd type (function block). So it is very easy to use and learn.
1. Session Tags
The code generator locates the source of a output file according to the sequence of sessions specified in the control.xml of the template. Each session tag carries a session name that identifies the lines of code that will be extracted.
2. Script Block
To generate codes according to the project settings, there are many script blocks in each session. Each script block is enclosed by special start and end tags.
In a script block, you can create variables and constants, use conditional statements, do looping, write procedures, etc. You can also access all settings in the project within the script block. (See Template Object Properties for details.) With script blocks, you can generate virtually any codes you want.
In this example the codes in between will only be generated if the table is a view. "TABLE" is a template object and "TblType" is one of its properties,
3. Function Block
Function block output an object property as string or output a string return by a function.
Note the "=" symbol immediately after the start tag. This is analogous to <%= ... %> in ASP.
The function can be a built-in system function or an user function defined in user code file (see Using User Code). You can refer to the System Functions list for functions that you can call or override.
Format 1 (accessing object property):
This line will write the project name in the output file.
Format 2 (access a function):
This line calls the function "MyFunction" and write the string returned by the function in the output file. In real cases, the returned string is the code you want to generate.
4. Function Block with Indentation
Note the "~" symbol immediately after the start tag. This function is same as function block above except that output block will be indented with the space before the block.