Re: [SMARTY] constants and config
| From: | (Alfred Tuinman) | Date: | Mon, 10 Mar 2003 22:52:24 +0000 |
| Subject: | Re: [SMARTY] constants and config | ||
| References: | 1 2 3 4 5 6 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-8541@lists.php.net to get a copy of this message | ||
Fabulous - it works well after the upgrade.
One problem though, often I pass config constants but once a while I pass
data from the database (too many to add to the config file).
I thought to perhaps add an underscore at the beginning to the database
stuff so that in the template I can say
{if substr($var,0,1)!='_'}{assign var=tmp value=$var}{/if}
Any other smart idea?
Thanks a million already to help me this far!
Alfred
Messju Mohr wrote:
> On Mon, Mar 10, 2003 at 12:02:13AM -0000, Alfred Tuinman wrote:
> > Further to me previous message I discovered I had received the following
> > error:
> >
> > [10-03-2003 05:20:23 (IST)] User Error
> > Error : Smarty: [in menus/leftmenu.tpl line 23]: syntax error:
> > $smarty.config is an unknown reference (Smarty_Compiler.class.php, line
> > 1805)
> > Page : /home/alfred/Smarty/Smarty_Compiler.class.php(1857)
> >
> > This means that $tmp did not get assigned right? but why
> i forgot to mention that {$smarty.config...} was added in 2.5.0-RC1 .
> > Alfred
> >
> > Alfred Tuinman wrote:
> >
> > > If I include that the template doesn't get displayed at all.
> >
> > > Is it maybe because it is in a section so tmp gets assigned a difference
> > > value each time it loops?
> >
> > > Alfred
> >
> > > 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}
> >
> > > > 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