I wan to inform about new release of template framework for PHP5 – web.template. It will be complexly rewrite, and I add same new, I think interesting features.
From this release, you don’t must use assign method (but you still can). Now you can make something like this:
Make class file:
Code: Select all
<?php
Class MyClass {
public function getHello() {
return ‘Hello world’;
}
}
?>Code: Select all
<?php
$tpl = new WebTemplate();
$tpl->setCacheDir('/home/public_html/wt/Tests/templates/cache/');
$tpl->setCompileDir('/home/public_html/wt/Tests/templates/compile/');
$tpl->setTemplateDir('/home/public_html/wt/Tests/templates/templates/');
$tpl->addVarClass('className, array('name'=>'MyClass', 'path'=>'./', 'extension'=>'.php')); //by default class is looking in file with class.php extension
/*
or:
$tpl->addVarClass('class', new MyClass());
*/
$tpl->display('test_var2.tpl');
?>Code: Select all
<b><wt:var name="className.hello"/></b>You can – of course – write you own modifiers, tags and resources (for example for store templates and cache in DB).
Feel free to download, test it and submit any bugs and suggestions.
This template framework can be used with web.framework (MVC framework for PHP5 - http://webframework.sourceforge.net/).
You can looking for web.template here http://sourceforge.net/projects/webtemplate/.
Best regards,
Marcin Staniszczak