Control File

The core of the template file is a control file named "control.xml". It is an XML file and it contains all the necessary information for the generation process. It is structured in 3 levels, namely the product, control and session level:

control.xml

<?xml version="1.0" standalone="yes"?>
<product>
    <control>
        <session/>
        ...
        <session/>
    </control>
    ...
    <control>
        <session/>
        ...
        <session/>
    </control>
</product>

 

 

1. <product>

The top level is the product level identified by the <product> tag. (The tag name "product" will be replaced by unique product name identifier in respective products.) It gives a brief description of the template and serves for product and version information purpose. PHPMaker will check changes in this tag every time you generate scripts with a template.

Syntax:

<product
    date="release_date"
    version="version_number"
    desc="description"
    language="lang_name"
    author="author_name">
...
</product>

 

Attributes Description
date Template creation date
version Template version number
desc Brief description of the template
language Language of the template
author Author of the template

 

2. <control>

The next level is the control level identified by the <control> tag. Each <control> specify an output file or a set of output files that will be generated by the code generator.

Syntax:

<control
    id="control_id"
    type="control_type"
    ofile="output_file_name"
    oext="output_file_extension"     
    ifiles="input_files"
    space="True/False"
    ofolder="output_file_folder"
    ofolderid="output_file_folder_id"
    remark="remark"
    cond="conditions">
...
</control>

 

Attributes Description
ofile Output file name
oext Output file extension
type

Control type:

"table" - table-related files:
For example, the scripts that will perform "list", "view", "add", "edit" and "delete" functions for the table. The output of this type is a set of file, one for each table.

"other" - other files:
These files are usually files that may be included or used by other files. For example, the config file and header/footer file.

"simple" - simple files:
Similar to other files, but no file prefix/infix/suffix will be used for these files

"copy" - files/folder that will be directly copied:
These files/folder that will be copied directly from the templates, such as image files. The target to be copied can be a file or a folder.

"folder" - folder entries to indicate folder path.
Used by other controls.

"system" - entries used by the system.
***IMPORTANT: DO NOT CHANGE.

id

Control ID. This attribute identifies which page is being generated.

Example:
type="table"
id="list" - list page
id="add" - add page
id="edit" - edit page
id="delete" - delete page
id="view" - view page
id="search" - search page
type="other"
id="loginh" - login page (hard coded user id and password)
id="loginl" - login page (use information from table for user id and password)
id="logout" - logout page
type="copy"
all ids are treated as files to be copied

ifiles List of input files to be processed (comma delimited)
ofolder Output file folder (relative to Destination Folder)
ofolderid Output file folder id (id to locate output file folder from folder control entries)
cond Condition for generation. (see below)
remark Remark for generation.
action

For use with extensions only.

"add" - add file or folder to the the main template, or
"change" - change file in the main template

 

 

3. <session>

The third level is the session level (identified by the <session> tag). For each <control>, there can be multiple sessions that will constitute the output. Each session can be a specific segment from the input files or an include statement.

Syntax:

<session
    type="session_type"
    value="session_value"     
/>

 

Attributes Description
type Session type:
"key" - output the code segment identified by the key from the list of input files
"include" - create an include statement
value Session value:
type="other"
key value of code segment (identified by session tags in input files)
type="include"
include file name
action

For use with extensions only.

"change" - change a session in the control level

 

Conditions

Condition checking is used in templates to control the code generation process. Codes will only be generated if the condition specified is met.

The syntax of condition checking is as follow:

condition1[,condition2...]

Condition format:

Object_Type/Object_Property/Operator/Value1[|Value2...]

Object Type and Object Property:
See Object Properties for details

Operator:
EQ = equal
NE = not equal
GT = greater than
GE = greater than or equal to
LT = less than
LE = less than or equal to
IN = contain value
NI = not contain value

Value:
value for comparison
(Note that single/double quotes are NOT required for string type values.)

 

 

 ©2002-2018 e.World Technology Ltd. All rights reserved.