Re: SV: [SMARTY] $smarty.post.myArray[index] in cvs
| From: | Monte Ohrt | Date: | Fri, 21 Mar 2003 14:26:19 +0000 |
| Subject: | Re: SV: [SMARTY] $smarty.post.myArray[index] in cvs | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-8809@lists.php.net to get a copy of this message | ||
We'll take a look. To work around it, assign the vars.
$smarty->assign_by_ref('_POST', $_POST);
{section name=index loop=$_POST.posted_vars}
{$_POST.posted_vars[index]}
{/section}
On Fri, 2003-03-21 at 04:09, Paolo Nesti Poggi wrote:
> Hi Monte or Messju
>
> I did'nt get any answer when I posted this last.
> However it's real issue to me, so here I try again, and a bit more correctly
> ;).
>
>
> smarty (up to 2.4.2. I believe) allowed to loop through a $_POST array with
> a section like:
>
> {section name=index loop=$smarty.post.posted_vars}
> {$smarty.post.posted_vars[index]}
> {/section}
>
> posted_vars are posted by means of:
> <input type ="hidden" name="posted_vars[]" value="value1">
> <input type ="hidden" name="posted_vars[]" value="value2">
> and so on
>
> With smarty 2.5.0 RC1 I get an error:
> syntax error: $smarty.post.posted_vars is an invalid reference
> (Smarty_Compiler.class.php, line 1681) in
> c:\php\pear\Smarty\Smarty_Compiler.class.php on line 1812
>
>
> This happens because the '[' bracket of "posted_vars[index" gets caught as
> being !='.' in line 1681
>
> Is it meant to be so, and if it is, how can I work around this.
> Obviously I happen to do something very wrong, as this seems to me to be a
> very basic use of Smarty.
>
> Regards
> Paolo
>
>
--
Monte Ohrt <monte@ispi.net>