Re: Hack to print defines
| From: | Monte Ohrt | Date: | Fri, 21 Sep 2001 22:58:14 +0000 |
| Subject: | Re: Hack to print defines | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-1516@lists.php.net to get a copy of this message | ||
If you hack smarty (or if it was ever supported), I'd do it in the
following fashion:
{$smarty.defined.foo}
We're trying to shy away from different syntaxes for different variable
types, as this becomes more confusing and harder to support as more are
added. I almost wish we would have stayed away from it in the first
place, using {$smarty.config.var} instead of {#var#} for example. But we
can't predict everything :-)
Anders Janson wrote:
>
> >>This doesn't seem like a good idea to me -- you are basically violating
> the separation of data/logic/presentation.
>
> The data/logic is still somewhere in my app - do the define. Presentation
> is in the template - print the defined stuff. The only logic I put
> in the presentation is to avoid printing an undefined constant's
> name as plain text.
>
> >> It's not that tough to assign constants to Smarty by using
> >> get_defined_constants(),
> that is, if you _really_ need to do it.
>
> Believe me, I would have used it, but for most people out there that
> function does not exist. Not yet. Many hosts are not even having
> PHP4.0.6 yet. When 4.0.7 is released AND in use by a majority of
> hosts - perhaps...
>
> /Anders
>
> ---
> You are currently subscribed to smarty as: monte@ispi.net
> To unsubscribe send a blank email to $subst('Email.Unsub')
> Visit Smarty's homepage at
> http://www.phpinsider.com/php/code/Smarty/
--
Monte Ohrt <monte@ispi.net>
http://www.ispi.net/