Simple
In the simple scheme, all template files are stored in a single directory. The directory is divided into two sub directories one for all the source files and one for all of the compiled template files. These directories must be called source and compiled, respectively.
If a file is not found in the template directory, then WACT looks in its own default directory for the template source. This is how default WACT error messages get merged with user programs.
By default, the simple file scheme looks for a directory called templates in the current directory. You may change this location by using a define statement.
Multi-lang
The multi-lang file scheme builds upon the simple file using search paths to define multiple languages for templates. With this file scheme, the template/source directory is further divided into subdirectories based on the type of files. Templates are stored in the templates directory, while string files are stored in a lang directory. The lang directory is further subdivided by language. The language to pick is set as a define in the program.
Switching File Schemes
The constant TMPL_FILESCHEME_PATH defines which template file organization scheme should be used. By default it's value is set like this:
if (!defined('TMPL_FILESCHEME_PATH')) {
define('TMPL_FILESCHEME_PATH', FRAMEWORK_ROOT . 'template/fileschemes/simple/');
}
This can be switched to the multi-lang scheme by defining it yourself in your code
define('TMPL_FILESCHEME_PATH', FRAMEWORK_ROOT . 'template/fileschemes/multilang/');
Future ideas
- Use search paths for template files to implement themes.
- Use search paths to implement “overridable” user templates. (So instead of the user editing the application templates directly, they make a copy of it in a different location or with a different name. The file scheme then recognizes the user defined template and overrides the corresponding template provided with the software package.)