Exemple #1
0
<?php

// Example FastTemplate Demo #1 - The example from the man page
// $Id: example_1.php,v 1.5 2006/02/14 12:27:33 paul Exp $
Header("Content-type: text/html");
include "cls_fast_template.php";
$ft = new FastTemplate("./templates");
$ft->php_in_html(true);
$ft->REWRITE_SRC_PATH = "www.google.com/";
$time1 = $ft->utime();
$ft->define(array('main' => "main.html", 'table' => "table.html", 'row' => "row.html"));
$ft->assign(array("TITLE" => "FastTemplate Test"));
for ($n = 1; $n <= 3; $n++) {
    $Number = $n;
    $BigNum = $n * 10;
    $ft->assign(array('NUMBER' => $Number, 'BIG_NUMBER' => $BigNum));
    $ft->parse("ROWS", ".row");
}
$ft->showDebugInfo(1);
$ft->parse("MAIN", array("table", "main"));
print $ft->utime() - $time1 . "\n";
$ft->FastPrint();
exit;
Exemple #2
0
<?php

//	Example FastTemplate demo #2: Build a linear web page. (top down)
//	Check your error_log when this is done - this demo has unresolved
//	variables defined in footer.tpl. (On purpose of course :)
// Header("Content-type: text/plain");	// If you want to see the
// raw html in your browser,
// uncomment this.
include "class.FastTemplate.php";
$tpl = new FastTemplate("./templates");
$start = $tpl->utime();
// Benchmarking
$tpl->define(array('header' => "header.tpl", 'body' => "middle.tpl", 'footer' => "footer.tpl"));
$tpl->assign(array('TITLE' => "FastTemplate Demo2", 'HEAD1' => "FastTemplate Page Demo", 'TD1' => "Column 1", 'TD2' => "Column 2", 'TD3' => "Cool Stuff", 'TD4' => '<BLINK>Cooler Stuff</BLINK>', 'MAILTO' => '*****@*****.**', 'LINK' => 'www.thewebmasters.net/php/', 'LINKNAME' => 'The WebMasters Net'));
$tpl->parse('HEAD', "header");
$tpl->parse('BODY', "body");
$tpl->parse('FOOT', "footer");
// $tpl->clear(array("HEAD","BODY"));	// Uncomment this to see how
// the class handles errors
$tpl->FastPrint("HEAD");
$tpl->FastPrint("BODY");
$tpl->FastPrint("FOOT");
$end = $tpl->utime();
$runtime = $end - $start;
echo "Completed in {$runtime} seconds<BR>\n";
exit;
Exemple #3
0
<?php

// $Id: cache_ex.php,v 1.4 2004/12/27 22:34:10 lvalics Exp $
// Cache Example
include "cls_fast_template.php";
$ft = new FastTemplate('./templates');
// CACHE will be used
$ft->setCacheTime(3);
$ft->USE_CACHE();
$ft->define(array("main" => "cache.html"));
$data = date("d/m/Y");
$ft->assign('DATA_ATUAL', $data);
$ft->assign("HORA", date("H:i:s"));
// Benchmarking
$start = $ft->utime();
$end = $ft->utime();
$runtime = ($end - $start) * 1000;
$ft->assign("DEBUGSEC", $runtime);
// end Benchmarking
$ft->parse("BODY", array("main"));
$ft->FastPrint();