2010-09-21 7 views

Répondre

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

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

Je dirais que vous pouvez trouver tout cela et plus juste regarder la documentation.

6

Si vous possédez déjà une baie existante via smarty, vous pouvez accéder aux clés et valeurs à l'aide de la boucle smarty foreach.

{foreach from=$array key="key" item="value"} 
{$key} => {$value} 
{/foreach} 
1
$country=array('INDIA','United State'); 
$smarty->assign('country',$country); 

Then you can use like 
{$country[0]} 
{$country[1]} 


$country=array('IND'=>INDIA','US'=>'United State'); 
$smarty->assign('country',$country); 

Then you can use Something Like This 
{$country.IND} 
{$country.US} 
Questions connexes