tags:

views:

24

answers:

2

hii to all..i am new to smarty..and i didnt look depth in smarty..i had an array.how can i get a particular key value as a string in smarty..

thx in advance.

A: 
$myarray['mykey'] = 'myvalue';
$smarty->assign('myarray', $myarray);

The value is: <strong>{$myarray.mykey}</strong>

I'd say that you can find all this and more just looking at the documentation.

djn
A: 

If you already have an existing array assigned via smarty, then you can access keys and values using the smarty foreach loop.

{foreach from=$array key="key" item="value"}
{$key} => {$value}
{/foreach}
Russell Dias