Re: template tamer
| From: | rush | Date: | Mon, 07 Apr 2003 11:29:33 +0000 |
| Subject: | Re: template tamer | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-142679@lists.php.net to get a copy of this message | ||
"Dan Rossi" <daniel@electroteque.org> wrote in message
news:EJECKPELDLGDPHHJOEDLKEHFEHAA.daniel@electroteque.org...
> hi guys , i am trying to get a demo of this working to see if its actually
> faster than fast template although, i cannot see anywhere where the acutal
> class file is ? and i have no idea why i have to use a standalone package
> rather than just a normal text editor like toher templates , any ideas how
> to get it working ?
Hi, I think I have allready responded in e-mail, but here is shorter answer
for the sake of the group (also if I was unclear please do not hesitate to
mail me again).
TemplateTamer is not just template engine, but a whole environment to work
with templates, which automates, and simplifies a number of chores when
programming with templates. It is not everyones cup of tea, but if this
approach suites you, TT can be of great help.
As for the template class you can not see it because there is none, TT
generates from html template a php code to perform necessary
transformations, depending on what you return from getData() function of
your page class. You can inspect the generated code if you are curious
though (it gets in page.php wher page is page name).
So in "classic" template system , you would instantiate template class, load
a number of templates into it call quite a few of transforms, and print the
end result. In TT, tt generates the code for the page, and your
responsibility is to write a class for the page, with getData function which
specifies the values of the variables, and templates that should appear.
Something like:
<?PHP
// Logic code for the TemplateTamer page: HELLO_WORLD
class hello_world_Page extends TemplateTamer_Page {
function getData() {
return array(
HELLO => array( ) ,
SOMEVAR => '123'
);
}
}
?>
It may seem as an overhead at first, but it releaves you from preparing
templates by hand, loading them, and calling all transformations by hand. It
also helps to achieve OO design, you can have one superclass for all pages
on your site, and just overide things that are different from page to page.
As for speed, I must say I did not run through benchmarks since I do not
think this would be main deciding factor. But if you would like to
prepare/adopt some benchamrk, please drop me an e-mail, and I'll try to help
out.
rush
--
http://www.templatetamer.com/