|
From: Todd O. <to...@da...> - 2001-03-28 22:11:46
|
I read ALL of the Smarty docs today and am VERY impressed with their
templating system; in fact, it's the best I've ever seen. I only have two
concerns:
1. I was not clear whether the templates would have to be re-parsed for
dynamic data.
--------- index.php --------
<?php
require("Smarty.class.php");
$smarty = new Smarty;
$smarty->assign("Name","Ned");
$smarty->display("index.tpl");
?>
--------- templates/index.tpl --------
<HTML> <TITLE>Hello</TITLE> <BODY>
Hello, {$Name}!
</BODY> </HTML>
The above would stay cached for 60 minutes, but would the following have to
be reparsed each run?
index.tpl (unchanged)
--index.php--
...
$smarty->assign("Name",$name_from_query);
$smarty->display("index.tpl");
...
How about
...
$smarty->display($template_name_from_database);
// instead of hardcoded template string like index.tpl
...
If the above would be cached, then Smarty should be considered VERY closely.
Alain, can you find out about this?
2. How should phpWebSite use templates? We definately need to rely on
style sheets first !! Assuming we are, how should we look at templates?
I'm thinking of a simple template for the entire site, which would adjust
the placement of blocks (i.e. nav bar, title, polls, articles, etc.). These
blocks would have their own HTML in the phpWebSite plug-in itself OR a
separate plug-in template file. The problem with this is whether or not
caching would be done by Smarty. I don't think it could cache this
arrangement, but maybe it doesn't need to.
The fundamental question is what are we looking to accomplish with
templates? I don't think phpWebSite is designed to be templated the way
Smarty was conceived--that is on a file by file basis, but I still think it
can be used to accomplish what we want, maybe even in its present form. But
what do we want--that is the question?
--Todd
|