(i)

DTEv2

Document Template Engine version 2 (DTEv2)

DTEv2 is a document template engine written in PHP, which provides powerful and convenient structuring for HTML and text documents, etc.

DTEv2 is a freeware under Uniwits Openware License.

DTEv2 can be downloaded here.

Points Highlights

  • Strictly separates HTML/text and PHP.
  • Supports WYSIWYG editors such as Dreamweaver.
  • Compile templates to boost performance.

Read More ...

Basic Syntax

Dataset of DTEv2

File Dependency & Template Parameter

Identifiers

Fixed Texts

Areas

Queried Texts

Queried Texts - Subqueries

Area Calls

File Importers

Hash Sign Repeaters

Text Selection

Fixed Text File

Area Selection

Area Commands

Output Methods

API Reference: The TemplateLoader Class

API Reference: The TemplateDriver Class

DTEv2 Support Thread

コメントなし 2013-09-23 03:36:19

DTEv2 Support Thread

 
 

API Reference: The TemplateDriver Class

コメントなし 2013-02-01 00:50:41

The TemplateDriver class. This class synthesizes compiled template file and a dataset into a product document.

The output methodScope: public
Parameters: None
Remark:

This procedure outputs the synthesized document.



Previous: API Reference: The TemplateLoader Class

 
 

API Reference: The TemplateLoader Class

コメントなし 2013-02-01 00:42:57

The TemplateLoader class. This class combines TemplateGenerator class and TemplateDriver class to provided a convenient delegation and a cached compilation. It means that recompilation only appears when necessary. With this caching, the template engine is greatly accelerated.

The constructorScope: public
Parameters:
NameTypeDescription
datasetThe dataset for the document as described in above sections.See dataset parameter of constructor of TemplateDriver class.
fixedLabelsAssociative array with string keys and string values.It is the "fixed list of texts" that are used by fixed texts (##method:{ID}##) and file importers (<?file({ID})?>). The "{ID}"'s are replaced by values mapped by this parameter.
Remark:

This procedure initializes a TemplateLoader instance.

 
The addLabelFiles methodScope: public
Parameters:
NameTypeDescription
filenameOrArrayText string of array of text strings.Name(s) of text files that contain fixed texts.
Remark:

This procedure add file names to the template engine. These names will be used on demand when the load function is called.

Each label file is automatically a dependent file. (See the load function.)

Files are added in the order that they appear in filenameOrArray.

Labels in files added later will overwrite the ones in the earlier added files.


The add_compiletime_output_filter methodScope: public
Parameters:
NameTypeDescription
filterObjectAn object that acts as a filter. It must has a method filter, which takes one parameter. This parameter is a string of characters to be outputed into the compiled cache file.
Remark:

The method filter(str) returns a transformed str. The object must NOT cache str for next call. Content of str is a piece of the document that a user agent receives.

These objects are only invoked when a template file is compiled.

 
The load methodScope: public
Parameters:
NameTypeDescription
tmplFileNameText string / Array of Text stringPath to the template file that will be loaded. If this parameter is an array, then each element of the array is a path to a template file. These files will be concatenated in the order that they appear in the array.
cachePrefixText stringA string to precede the file name of the compiled file name. This parameter is used to indicate the cache folder. Note: raw string concatenation is done, therefore if the compile file has name "name" and the cachePrefix="folder", then the resulting path to the compiled file will be "foldername". Supply NULL to disable cache.
parameterText stringArbitrary text string that will be passed to compiledFileName method to distinguish same template file with different parameters.
dependsOnFilesArray of stringEach element of the array is a path to a file on which current template file depends. Therefore, even if the template file is not updated, but the dependent files are updated, the template file will be recompiled.
Remark:

Load the template file into memory, and do recompilation if necessary.

Returns a TemplateDriver instance that can be used to output the template.

 
The loadLabelFromText methodScope: public static
Parameters:
NameTypeDescription
wholefileText stringThe text string that is in format of the fixed text file.
Remark:

Convert the content of the wholefile into an associated array of the form "name"=>"value" as if the contents are loaded from a fixed text file, and returns the associated array.

 
The loadLabelFromFile methodScope: public static
Parameters:
NameTypeDescription
filenameText stringName of the file from which the fixed labels are loaded.
Remark:

Convert the content of the file identified by filename into an associated array of the form "name"=>"value", and returns the associated array.

 

Next: API Reference: The TemplateDriver Class

Previous: Output Methods

 
 
ユーザ規約 | UNIWITS.COM よりご提供