Re: [SMARTY] write out data from array
| From: | messju mohr | Date: | Tue, 25 Mar 2003 11:20:45 +0000 |
| Subject: | Re: [SMARTY] write out data from array | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-8881@lists.php.net to get a copy of this message | ||
On Tue, Mar 25, 2003 at 08:59:21AM +0100, Jiri Nemec wrote:
> Hello,
>
> i have got problem with writeout in template items from array:
>
> there is an array something like it:
>
> datas:
>
> array(3) {
> [17]=>
> string(1) "5"
> [36]=>
> string(1) "5"
> [136]=>
> string(2) "10"
> }
>
> this works in clean PHP:
>
> <?php echo $datas[$id_item]; ?>
>
> but I don't know how to type out the value from an array in teplate.
> in template I by section tag write out all items from one category, I
> have got item-ID and I need to writeout value of item in shoppinf cart.
- use $array[$key] for numeric indices
- use $array.$key for associative array
- read about this at: http://smarty.php.net/manual/en/language.variables.php#LANGUAGE.ASSIGNED.VARIABLES
- don't ask me why smarty distinguishes between the two types
have fun
messju