When you look at our Smarty files, they're not pure XHTML with just a small smidgen of Smarty tags inside. They're XHTML with a lot of Smarty tags inside. So, this presents two problems. One, a new developer needs to learn the Smarty lingo and the dos and don'ts of it as well (which unfortunately they learn later or by trial and error). Two, if you're trying to get away from spaghetti code of logic and XHTML mixed together, it defeats the purpose.
Next, let's take a look at the process of how you use Smarty typically.
1. First, you instantiate your personal Smarty class, as I do here:
Code: Select all
require_once('SMARTY.php');Code: Select all
$smarty->assign('bigtable',$sTable);Code: Select all
$smarty->display('report.tpl');So then you have to ask yourself how this isn't different from doing this:
1. You don't need to instantiate any class. It's PHP and can do just fine on its own.
2. Now we start assigning variables, like:
Code: Select all
$sDisp_Table = '<TABLE><TR><TD>blah...........</TABLE>';3. And then we draw it on the screen by loading our XHTML template like:
Code: Select all
require_once('templates/report.php');Code: Select all
<?= $sDisp_Table ?>And, it might actually run faster than the Smarty technique.
That's my two cents.