Var Templates

From: Date: Tue, 15 Apr 2003 23:09:22 +0000
Subject: Var Templates
References: 1  Groups: php.smarty.dev 
Request: Send a blank email to php-smarty-dev+get-1175@lists.php.net to get a copy of this message
Hi all. FWIW, I've been casually following the long discussion on backticks and automatically expanding vars as if they were themselves templates. I think it was Tom Sommer who initiated that discussion, but if not, he certainly has put a lot of interesting details on the table. One thing I am uncertain of is the need for such a thing in the base Smarty engine. From Monte Ohrt's comments, it looks like this type of change has potential to wreak havoc with performance and in the end, I'm not sure why anyone would REALLY need this feature--at least in the engine core. There are two issues I'm concerned about: 1) there seems to be a push to program general COMPUTATION using the template facility instead of PHP code. I'm -1 on that because I think that as much as possible, logic should be handled in the PHP code. Otherwise your templates aren't really templates, are they? In other words, if you want to evaluate a var using templates and then use that value in another template, you should probably do the first evaluation in PHP and pass the results to the second template. Both your code and your templates are likely to be a bit more stable in that case. 2) I want the base Smarty to stay as minimally small (and fast!) as possible. IMHO, anything that can be implemented effeciently using the Smarty API (ie. plugins, resources, filters) should be factored out of the engine. For example, the functionality that Tom is talking about can likely be created using a custom Resource. I posted a very simple Global Var template reader to the Wiki back in september that shows how to go about doing a similar thing (it would have to be expanded to meet Tom's criteria). The point is, is that there is a LOT of room to extend functionality without trying to shoehorn everything into the core. This is especially true for the more abstract and escoteric features that we developers sometimes crave :). xo boots __________________________________________________ Do you Yahoo!? The New Yahoo! Search - Faster. Easier. Bingo http://search.yahoo.com

« previous php.smarty.dev (#1175) next »