web.template 0.9.0 has been released

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
User avatar
staniszczak
Forum Newbie
Posts: 13
Joined: Wed Oct 05, 2005 1:39 pm
Location: Radomsko, Poland

web.template 0.9.0 has been released

Post by staniszczak »

Hi,

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’;
   }
}
?>
And in index.php for example:

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');
?>
And here you are template:

Code: Select all

<b><wt:var name="className.hello"/></b>
So now template can ask your class about data that it required and only if template need it;-) Sorry for my English;-)

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
Post Reply