PHP Fast Template - Assigning templates to objects
(Page 2 of 6 )
Once the class file has been included, HTML templates can be assigned to an array for use throughout the script.
First, a new template object must be instantiated like this:
$tpl = new FastTemplate("../templates");
The path in quotes points to the location of the HTML
templates being used. This will vary depending upon personal preferences.
Once the instance exists, external HTML templates are assigned to variables in the array like this:
$tpl->define(array(
"index_tpl" => "some_html_template.tpl"
));
In the above code, "index_tpl" is arbitrary. In fact many
solutions involve assigning many templates to variables within one instance.
An example of multiple templates declared for use in a script:
$tpl->define(array(
"index_tpl" => "some_html_template.tpl",
"sub_idx_tpl" => "another_html_template.tpl",
"last_idx_tpl" => "last_html_template.tpl"
));
Next: Assigning variables to FastTemplate objects >>
More PHP Articles
More By Ian Felton