2011-11-17 89 views
1

我有一個數組$cand_detailprint_r($cand_detail)顯示:數組不顯示在smarty

Array ([0] => Array ([0] => stdClass Object ([cand_f_name] => Nitish [cand_l_name] => Dolakasharia [cand_email] => [email protected] [cand_password] => *5D47AA16D3C7B8B748B89E16DE11C54CB0CF37DF [cand_phone] => 7878777887 [cand_qualification] => ba [cand_industry] => [cand_experience_yr] => 0 [cand_experience_mn] => 5 [cand_message] => [cand_id] => 1 [cand_resume] => resume/tourist map details.doc)) [1] => Array ([0] => stdClass Object ([cand_f_name] => Anupam [cand_l_name] => Baruah [cand_email] => [email protected] [cand_password] => *5D47AA16D3C7B8B748B89E16DE11C54CB0CF37DF [cand_phone] => 45465465 [cand_qualification] => eng_mch [cand_industry] => [cand_experience_yr] => 3 [cand_experience_mn] => 4 [cand_message] => [cand_id] => 2 [cand_resume] => resume/tourist map details.doc))) 

現在我分配的值給Smarty:

$this->assign_values('cdetail',$cand_detail);

而在智者:

{foreach name = feach item = v from = $cdetail} 
    First Name : {$v.cand_f_name}<br /> 
{/foreach} 

但它沒有顯示考生的名字,它變黑了。

回答

1

數組中的項是一個對象,所以你需要指向使用->領域。此外,它看起來你正在使用一個二維數組。

{foreach name = feach item = clist from = $cdetail} 
    {foreach item = v from = $clist} 
     First Name : {$v->cand_f_name}<br /> 
    {/foreach} 
{/foreach}