A template is a zip file of code snippets needed to generate the output files. Template is fully customizable, you can customize the default template shipped with the product to suit your own needs in your apps.
To generate output files, the code generator first unzips the template to the subfolder \<product name>\Templates\<template name> under your Documents folder, pre-processes the scripts in the template into template cache, then use the template cache to generate output files. If the unzipped template already exists, the code generator will skip the unzip process and reuse the template cache so the time required for generation is minimized.
If you want to customize a template, normally you customize the files in the zipped template, but you'll need to zip it back after customization, for example, by dragging the customized files back to the zipped template. The unzipped template under the Documents folder provides an optional way to customize the template without re-zipping the template. Either way, you should zip it back after all the customizations are done.
If you prefer to work with the unzipped template but you have not generated any files yet, do once first. Then you can modify the unzipped files under the subfolder named "Script". For example, if the template archive is named as "appv<version>.zip", it will be unzipped to the folder <document folder>\DBAppMaker\Templates\appv<version>\, you can modify files under the subfolder "Script" under it.
When changes in the zipped template is detected, the code generator will ask you to confirm overwriting the old unzipped version, you should answer carefully, especially if you've implemented some customizations previously. Always back up your customized template first!
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. During generation the code generator will parse the control.xml and follows the instructions to generate the output files one by one. If you want to add an output file, you need to add a <control> tag in the control file. If the file is to be included in other file(s), you may need to add <session> tags in control.xml also. See Control File for details.
All the phrases in the template are separated into a single XML language file for easy translation to other languages and sharing. If you want to translate a template, this should be the only file you need to translate.
Language files are placed in the subfolder "languages" under the installed folder. The files are used for all templates.
You can edit or even add your own phrases. Just open the language file with any text or XML editor, edit/add your <phrase> nodes. Make sure you provide an unique id to each phrase. The id must be alphanumerical only.
Read Config Settings (General -> Default Language) on how to select language file(s) for a multi-language project before generation.
The template files and output files are in ASCII encoding by default. Since the phrases are separated into XML language files in utf-8 encoding, ASCII encoding will suit most cases as the scripts contain code only. When you customize a template, it is recommended you use the language file also. If you have to put unicode characters directly in the template files, you must always use utf-8 and save the file in utf-8 encoding with the byte order mark (EF BB BF).
Subfolders are defined in control.xml, if you want to add and copy additional subfolders, you also need to add a <control> tag in the control file.
The code generator processes the Template Tags, assembles the output files using the code snippets from template files and generate code according to Object Properties. Template object properties are project settings either inputted from the user interface or restored from a project file. Template Tags are in the format of HTML comment, when you customize template you should use an editor that will not unexpectedly alter or remove the HTML comments, otherwise incorrect result may occur.