Re: Documentation problem on QUICKSTART file
| From: | Monte Ohrt | Date: | Thu, 01 Nov 2001 21:16:28 +0000 |
| Subject: | Re: Documentation problem on QUICKSTART file | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-1799@lists.php.net to get a copy of this message | ||
Joao,
The syntax of {$array_name[index_outer][index_inner]} is used when you
have nested sections you are looping through, just as this example in
the QUICKSTART guide. If you want to reference the value of an index key
of a looped variable, then you would do as you described. I don't see a
problem with the QUICKSTART syntax, as it is referencing
{$ContactNames[people][contacts]}, where "people" is the name of the
outter loop and "contacts" is the name of the inner loop. "contacts" is
NOT the name of a key in the array, as you were probably thinking.
Monte
Joao Prado Maia wrote:
>
> Well, after loosing several hours of work following the syntax described
> on the end of the QUICKSTART text file available on the following URL:
>
> http://www.phpinsider.com/php/code/Smarty/QUICKSTART
>
> thinking that the last example of nested arrays would also be correct for
> a nested associative array inside a normal index based array, I figured
> out that you should use something like this:
>
> $array_name = array(
> 0 => array(
> "test" => "hello"
> )
> );
>
> {section name="named_index" loop=$array_name}
> {$array_name[named_index].test}
> {/section}
>
> and not
>
> {$array_name[named_index][test]}
>
> Maybe adding such an example to that file would help maybe another person
> in the future ?
>
> Cheers,
> Joao
>
> --
> João Prado Maia <jpm@phpbrasil.com>
> http://phpbrasil.com - php com um jeitinho brasileiro
> --
> Precisando de consultoria em desenvolvimento para a Internet ?
> Impleo.net - http://impleo.net/?lang=br
>
> ---
> You are currently subscribed to smarty as: monte@ispi.net
> To unsubscribe send a blank email to $subst('Email.Unsub')
> Visit Smarty's homepage at
> http://www.phpinsider.com/php/code/Smarty/
--
Monte Ohrt <monte@ispi.net>
http://www.ispi.net/