Re: [SMARTY] What's wrong?
| From: | Nino Katic | Date: | Mon, 18 Aug 2003 14:09:16 +0000 |
| Subject: | Re: [SMARTY] What's wrong? | ||
| References: | 1 2 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-10086@lists.php.net to get a copy of this message | ||
On Mon, 18 Aug 2003, messju mohr wrote:
>
> On Sat, Aug 16, 2003 at 08:11:49PM +0200, Nino Katic wrote:
> > Hi,
> >
> > This is working fine in Smarty 2.4.2, but not in 2.5.0
> >
> > {section name=bjez loop=$smarty.session.svijezici}
> >
> > {$smarty.session.svijezicikratki[bjez]}
> >
> > {/section}
> >
> > Is says:
> >
> > Fatal error: Smarty: [in
> > file:c:/Project/templates/test/generalinsert.tpl line 104]: syntax
> > error: $smarty.session.svijezicikratki is an invalid reference
> > (Smarty_Compiler.class.php, line 1693) in
> > c:\Projekti\Smarty-2.5.0\libs\Smarty_Compiler.class.php on line 1824
>
>
> this is a limitation of the $smarty-special-var. it doesn't allow more
> complex dereferencing than the "." after $smarty.* . i was always
> unsure if this restriction is good (to disencourage people using
> get/post/cookie/session directly instead of piping it through their
> business-logic and assinging it to a "normal" template-variable) or if
> it is a bug.
Using get/post/cookie/session vars directly in a template has some
advantages, because you don't have to assign same values to the same
template vars in multiple php files.
> i recently decided, although accessing session-vars directly from the
> template is not nice, making it an invalid reference it is a bug and
> committed a fix.
I also wanted to solve the problem, so I took a little "peek" into the
Smarty.compiler code and I saw a difference in one forech that is doing
the check of those wars. Commenting it solved my problem. Anyway thx. for
a fix.
Nino