Template Explained

A template is a zip file. It is an archive of the necessary files needed to generate the output files.

The core of the template file is a control file named control.xml. It is an XML file containing all the necessary instructions for the generation process.

To generate output files, the code generator first unzips the template to the subfolder \<product name>\Templates\<template name> under your My Documents folder, pre-processes the scripts in the template, then parses the control.xml and follows the instructions to generate files one by one. If the unzipped template already exists, the code generator will skip the unzip process and reuse the pre-processed scripts. This can speed up the code-generation process and allow user to customize a template without unzipping and zipping the template archive.

My Documents Folder
The My Documents folder is your own personal folder in which you can store your personal files. For example, in Windows XP, the target or actual location of the My Documents folder is C:\Documents and Settings\<user name>\My Documents by default, where C is the drive in which Windows is installed, and <user name> is the currently logged-on user.

The code generator processes the Template Tags, assembles the output files using the code snippets from template files and generate dynamic codes according to Template Object Properties. Template object properties are project settings either inputted from the GUI or restored from a project file.

All the wordings in the template has been separated into a single Language File named lang.xml for easy translation to other languages and sharing. The values are not limited to text, you can use HTML tags if applicable.

Language File
A default language file named "lang.xml" is placed in the subfolder "src" under the installation folder. The file is used for all templates. You can make a language file template-specific by putting the file in the template folder. The code generator look for a "lang.xml" file in the template first, if it is found, the default language file will not be used. The language file is an XML file, when you edit the file, make sure that you keep it well-formed. If you use HTML tags or special characters in the attributes of the XML tags, you need to use entity references. For example, to insert the ">" symbol, you need to use "&lt;".

A template is fully customizable. (See Customizing Template) However, note that customizing templates requires necessary knowledge in the related technologies and HTML. Advanced users can customize the dynamically generated codes by overriding an existing template tag. To override an existing template tag, you need to add your own function in the User Code File. (See Using User Code)

User Code File
By default, the User Code File is named as "usercode.vbs" and can be found under the "src" subfolder of the installed directory.

Furthermore, custom function is also allowed. To call the custom functions, you need to add the functions in the User Code File. Then just use template tag to call them in the template. (See Using User Code)

Extensions
An extension is modification of template to make the template supports additional feature(s) implemented in the extension. An extension is a template itself, it has the same structure as template and you can modify them in exactly the same way as modifying the main template. Extensions are processed after the main template, it may add or change some files in the template.

Extensions files (in zipped format) must be place under the subfolder "extensions" of the installation folder. Each extension must have a XML description file so the product can load the available extensions in the user interface for selection. You can open an XML file in the "extensions" subfolder to see the content, which is self-explanatory.

 

Also See:

Control File
Customizing Template
Template Tags
Template Object Properties
Using User Code

 

 ©2008 e.World Technology Ltd. All rights reserved.