When using Dot_Template to generate HTML or other code from templates, you do the following steps:

  1. Create template class instance
  2. Load template file
  3. Define blocks
  4. Set variables, parse blocks
  5. Finish and output

Variables are placeholders in your HTML code that can be replaced with dynamic values provided from database or calculated in your code. An example for a variable is {CODE_AUTHOR}: You enclose the variable name in curly braces. The name of the variable may contain any characters, except spaces, tabs and newlines.

Blocks surround certain pieces of HTML code and can be re-used, e.g. a <tr>row in a table. Blocks are defined by using HTML comments, containing BEGIN or END, and the block name. Example:

<!-- BEGIN authorline -->
<!-- END authorline -->