1.使用smarty语法 |
{ if $current_item |in_array: $selected_array } |
2.使用php语法,直接在smarty模板中调用php的in_array函数 |
{ if in_array( $current_item , $selected_array )} |
例子:判断是否已选中 |
<input name= "items[]" type= "checkbox" value= "{$val.Id}" { if $val .Id|in_array: $selected_array }checked= "checked" {/ if } /> |