Re: [SMARTY] assign
| From: | Monte Ohrt | Date: | Thu, 08 Jan 2004 15:27:45 +0000 |
| Subject: | Re: [SMARTY] assign | ||
| References: | 1 2 3 4 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-10796@lists.php.net to get a copy of this message | ||
Actually, if you are only going to be displaying the errors for one
parameter at any given time, I would keep the template logic simpler and
assign only what is needed:
{$smarty->assign('errors', $errors[$paramName]);
{section name=err loop=$errors}
{$errors[err]}
{/section}
On Thu, 2004-01-08 at 09:20, Monte Ohrt wrote:
> $smarty->assign('errors', $errors);
> $smarty->assign('paramName', $paramName);
>
> {section name=err loop=$errors.$paramName}
> {$errors.$paramName[err]}
> {/section}
>
> On Thu, 2004-01-08 at 09:05, Hodicska Gergely wrote:
> > Hi!
> >
> > And I have another problem related to this.
> > My framework validates the input parameters, and if any error occures I
> > add the error message to an array:
> > $errors[$paramName][] = $errorMsg;
> >
> > And I thought, that I could pass this array to smarty.
> >
> > But if the param name is something like this: 'x[y]', I can't access the
> > proper array element?
> >
> > Felho