Re: [SMARTY-DEV] Var Templates

From: Date: Wed, 16 Apr 2003 17:45:35 +0000
Subject: Re: [SMARTY-DEV] Var Templates
Groups: php.smarty.dev 
Request: Send a blank email to php-smarty-dev+get-1198@lists.php.net to get a copy of this message
Tom, I just re-read your first message in the thread (http://lists.php.net/article.php?group=php.smarty.dev&article=1104). I can see the reason one might want to have smarty template vars in config files, but I think your original example implies a very different overall (and standard) treatment in Smarty, namely: t1.tpl ------------- this is a test, see my var {$var} here t2.tpl ------------- {include file=t1.tpl var=VarValue} Note how this will likely lead to permanent compilation of the template :). What I think COULD be useful is extending the include function to allow for partioning of a template resource into sections that can be individually loaded (much like config files). I have purposely chosen some arcane syntax because I am not trying to suggest the actual implementation, only to illustrate the idea: t1.tpl ------------- {portion name=MyTest1} this is a test, see my var {$var} here {/portion} {portion name=MyTest2} this is another test, see my var {$var} here {/portion} t2.tpl ------------- {include file=t1.tpl var=VarValue1 portion=MyTest2} By borrowing the scoping feature of config vars and adding that to {include}, we can do away with config files altogether and simply make them a special (user defined) case of template files. I want to add one more problem I have with your idea: the use of alternate syntax. We already have braces (or something user defined) to imply variable expansion. Adding un-braced backticks as an additional expansion method just seems wrong to me. At any rate, I'm not convinced that the change you want is really forwarding the engine in any meaningful way. Then again, I've been known to be wrong ;). xo boots __________________________________________________ Do you Yahoo!? The New Yahoo! Search - Faster. Easier. Bingo http://search.yahoo.com

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