$flexy->compile() -- Converts a template from markup to PHP if required ïÐÉÓÁÎÉÅ
If neccessary it will convert the Template markup into PHP code, and writes
it to the compiledTemplate directory adding the {locale}.php to the end of the filename.
The Template is only compiled if
It is not normally neccesary to set the forceCompile flag, unles you are working
on the engine it'self.
÷ÏÚ×ÒÁÝÁÅÍÏÅ ÚÎÁÞÅÎÉÅ
string - the location of the compiled file (which could be used
with include) - although it is recommended to use the outputObject methods.
úÁÍÅÔËÁüÔÁ ÆÕÎËÃÉÑ ÎÅ ÄÏÌÖÎÁ ×ÙÚÙ×ÁÔØÓÑ ÓÔÁÔÉÞÅÓËÉ. ðÒÉÍÅÒПример 27-1. Compiling multiple files.
<?php
class controller_test
{
var $masterTemplate = "master.html"
var $template = "home.html"; // name of template
var $title; // page title;
var $numbers = array(); // an array example
/* start section - deals with posts, get variables etc.*/
function controller_test()
{
$this->start();
$this->output();
}
function start()
{
$this->title = "<Hello World>";
for ($i = 1;$i< 5;$i++) {
$this->numbers[$i] = "Number $i";
}
}
/* output section - probably best to put this in the default_controller class */
function output() {
$master = new HTML_Template_Flexy();
$master->compile($this->masterTemplate);
$master->outputObject($this);
}
function outputBody() {
$body = new HTML_Template_Flexy();
$body->compile($this->template);
$body->outputObject($this);
}
}
new controller_test;
?>
|
|
|