The WACT Template Component Architecture is what drives the Template View it implements. There are two types of components used by WACT, divided into Compile Time components and Run Time components.
The reason for this seperation is to eliminate the cost of intepreting the source template into native PHP code to only those instances where the source template changes (rare).
The big picture of how the templates work looks like
(described in detail on the DataTableColumnLabels page)
The reason for this seperation is to eliminate the cost of intepreting the source template into native PHP code to only those instances where the source template changes rare.
Are used by the template parser to build a compiled template, when a WACT tag is found in the source template.
For example the ListTag as the CompileTime component ListListTag. This might generate the following, which is placed in the compiled template formatted for readability
<TABLE BORDER="1" ALIGN="CENTER"> <?php $DataSpace->children['ListExample1']->prepare(); $A =& $DataSpace->children['ListExample1']->DataSet; if ($A->next()) { do { ?> <TR> <TD><?php echo $A->get('First'); ?></TD> <TD><?php echo $A->get('Last'); ?></TD> </TR> <?php } while ($A->next()); ?> </TABLE>
Generally speaking, when developing an application with WACT, unless you wish to define your own tags, you shouldn’t need to bother with Compile Time Components.
The Run Time components are constructed by a compiled template when it is part of an HTTP request. The Run Time components are what you are concerned with building applications using WACT. Run Time components extend the DataSpace, typically being a subclass of Component of TagComponent. In more general GUI terms, think of Run Time components as being “widgets” or “controls”.
They provide an API for accessing data stored in the DataSpace as well as navigating the runtime component heirarchy modifying their appearance when output through their XML attributes.
The compiled templates contain two functions, one being a hash of the of source template filename, which is called when Template is constructed, and builds the runtime components. The second, the render function, executes the compiled PHP code which displays the page, populating the template with data.