Reply to Re: [SMARTY] Smarty and constants

Your name:

Reply:


Posted by boots on 07/13/05 18:24

--- Erik Schmitt <e.schmitt@e-novum.com> wrote:
> Hello,

Hi.

> recently I asked how to access constants in a dynamic way.
> The solution is to use
>
> {$smarty.config.$bla} instead of {#$bla#}.
>
> But in my case $bla is the result of calling an
> object method. Hence I have to write:
>
> {assign var="bla" value=$myObject->myMethod()}
> {$smarty.config.$bla}
>
> Somethink like {$smarty.config.`$myObject->myMethod()`}
> does not work.
>
> On the other hand, smarty will stop with a syntax error
> if it finds a leading $ like in {#$bla#}. So what about
> simply allowing smarty to evaluate the "content" if it starts
> with a $?
>
> (In my case, the methods are returning IDs for strings in
> a language files, with some of the IDs stored in a DB).
>
> What do you think?

You may be interested in the following thread at the forum:

http://www.phpinsider.com/smarty-forum/viewtopic.php?t=3806

Basically, it affords a way to decouple dynamic lookups without adding
new syntax or magic, eg:

{$myObject->myMethod()|lookup:$smarty.config}

xo boots


__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация