Re: [SMARTY] constants and config
| From: | messju mohr | Date: | Sun, 09 Mar 2003 21:15:38 +0000 |
| Subject: | Re: [SMARTY] constants and config | ||
| References: | 1 2 3 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-8511@lists.php.net to get a copy of this message | ||
On Sun, Mar 09, 2003 at 08:46:59PM -0000, Alfred Tuinman wrote:
> I try to print this where $menu is an array of config constants (menu
> options) ie it has to become a {#something#}
>
> {section name=menu loop=$menu}
> <tr><td>
> <a href='{$menu[menu].menuLink}'>{$menu[menu].menuItem}</a>
> </td></tr>
> {/section}
ah, i see. you mean the value of {$menu[menu].menuItem} is "#something#"
and you want to get the value of the corresponding config variable?
do this:
{assign var=tmp value=$menu[menu].menuItem}
{$smarty.config.$tmp}
(i don't think it can be done in one stroke)
{$smarty.config.???} is an internal array of smarty that gives you
access to the assinged config-variables.
like {$smarty.config.something} or {$smarty.config.$tmp}
HTH
messju
> Alfred
>
> Messju Mohr wrote:
>
> > On Sun, Mar 09, 2003 at 03:16:31PM -0000, Alfred Tuinman wrote:
> > > I am converting FastTemplates to Smarty...
> > >
> > > I have a dynamic menu so I cannot put the constants in the template itself.
> > >
> > > So how do I load a constant into the template and get it to be converted
> > > by its value in the config files.
> > >
> > > If I do $smarty->assign('test','#TEST#'); it prints just
> > > #TEST#
> > >
> > > I'm sure there must be an easy way I have overlooked but...
> > >
> > > any ideas?
>
> > you mean a php-constant? then:
>
> > {assign var=tmp value=#TEST#}
> > {$smarty.const.$tmp}
>
>
> > > Alfred
>
>
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--
It is essential that implementations by different vendors interoperate.:
Unsere proprietären Basteleien dokumentieren wir gar nicht erst.
Sven Türpe