I'm a little late on this topic, but here my two cents.
I've been working on CMS for a while too Tekime. I've got one site I maintain. I use this site to test my own script and just about everyone else's. I've used both FastTemplate and Smarty and didn't like either. Here's why.
Now some are going to think I'm being nasty, but I have nothing against the people who use Smarty or those who created Smarty. Personally, I perfer to not even to open my mouth about it as I'm an introvert. But, I find it difficult to keep my mouth shut when logic is being toss out like the trash on Wednesday. So with that said. Let's pick on Smarty.
Directly from the website:
Smarty is a template engine for PHP. Smarty provides your basic variable substitution and dynamic block functionality, and also takes a step further to be a "smart" template engine, adding features such as configuration files, template functions, variable modifiers, and making all of this functionality as easy as possible to use for both programmers and template designers.
"Smarty is a templating engine for PHP." What? PHP is a templating engine. So, why do we need Smarty? Any thing they can do, PHP is doing for them and could do faster. If smarty was a standalone programming/script language I would have no problem with it. But, it's not. It's sitting on top of a more powerful template engine that does everything it does and more.
Smarty provides "basic variable substution." What's so basic about it? They're parsing HTML for they're variables! Isn't that what PHP is already doing! Or have we all forgotten that everything outside of these "<?php ?>" is HTML? So which is more basic?
1. <?php echo $title; ?>
or
2. {$title}.
Want to guess which one is faster?
Smarty provides "dynamic block functionality." Dynamic block's? Hold on, templates are suppose to seperate logic from layout. What's with these dynamic block's then? Here you are putting logic back in the templates. No matter whether you call them "sections" or "for..next loops" they're still logic constructs! It's should go without saying that PHP will whip Smaty's ass in any loop. (See above code and think about it.)
Smarty provides "configuration files, template functions, variable modifiers, and making all of this functionality as easy as possible to use for both programmers and template designers." Hold on doesn't PHP provide all that and more? How is it easier, your making me learn a new programming language called Smarty! And the template guy was warried when I mentioned PHP, now he's wondering what the heck "Smarty" is.
You know what the problem is? It's not Smarty, it you and me. I have no problem understanding either HTML or PHP. I can intermingle them and still understand them. They both make sense to me. But, not everyone is as luck. That poor template designer sure doesn't want to learn a server side scripting language. The template designer isn't a programmer, so we have to help him out. How can we help him? Let's keep it simple and seperate the logic from the layout. We can do that without Smarty and we can do it better.
We can create powerful templates, limiting ourselves to simple PHP statements. Keep the logic in a .php file and the layout in an .html file. If it takes more than one PHP statement it doesn't belong in the template file. If it involves more than an echo or a simple "if" statement than it doesn't belong in the template file.
It should be as simple as one, two, three.
- Include any libraries you need.
- Create the variables.
- Include the template file.
That simple. Click, you got a web page.
Simple template example.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<META HTTP-EQUIV="Expires" CONTENT="Sat, 23 Nov 2002 01:28:44 GMT">
<TITLE><?php echo $site_title; ?><?php if($page_title){echo ' - '.$page_title;} ?></TITLE>
<META NAME="keywords" CONTENT="<?php echo $site_keywords; ?>">
<META NAME="description" CONTENT="<?php echo $site_description; ?>">
<META NAME="author" CONTENT="Buddha">
<META NAME="ROBOTS" CONTENT="ALL">
<script language="javascript" src="common.js" type="text/javascript"></script>
<link title="Contemporary" href="common.css" type="text/css" rel="StyleSheet">
</head>
<body text="#000000" bgcolor="#ff0000">
<?php echo $content; ?>
<br>
<?php echo $counter; ?>
</body>
</html>
Now you can fill in those variables anyway you want. Get them from a database, flat file, or embed them in the script. But, the template designer doesn't need to know how you do it. All he needs to know is anything in between "<?php" and "?>" is off limits.
I'm the less worthy among us to be giving anyone advice on programming. However, I think there's some logic in my statements. Please give them some consideration.
Let the flaming begin...