Template Interface Engine joins back-end code (as business logic layer) and HTML code (known as presentation layer) which are written in separate files. This class implements a template engine that uses regular expressions to locate placeholder marks. It supports template loops and uses event driven callback functions to set variables inside the loop sections. Outside loop sections, the variable values can set directly. The tags used by this engine are enclosed by comment HTML tags, so the templates layout can be edited later by any WYSIWYG HTML editor. Supported tags are: LOOP, IF, ELSEIF, ELSE and INCLUDE. The engine is equipped by configuration file for customization. It also may handles multiple files (such as header, body and footer) and supports '_PIPE' output instead of stdout or as file. |