: 나는 특정 체크 박스를 만들고 싶어 스마티 템플릿에서 양식에 이제배열에있는 요소의 특정 요소 존재를 확인하는 방법 smarty?
Array
(
[op] => import
[contact_list_id] => 9
[form_submitted] => yes
[cl_user_type] => Array
(
[0] => upload_from_file
[1] => copy_paste_from_excel
)
[registered_users_from_date] =>
[registered_users_to_date] =>
[logged_in_users_from_date] =>
[logged_in_users_to_date] =>
[not_logged_in_users_from_date] =>
[not_logged_in_users_to_date] =>
[test_pack_type_id] =>
[submit_value] => Submit
)
:
$smarty->assign('data', $contact_list_user_data);
배열은 다음과 같습니다 일치하는 값이 find인지 검사합니다. 하지만 올바른 방식으로 배열을 구문 분석 할 수 없습니다. 간단히 말해서 하위 배열 cl_user_type
의 값이 폼에있는 체크 박스의 값으로 매치되면 체크 박스를 선택하고 싶습니다. 위의 경우 마지막 두 개의 확인란을 선택해야합니다. 이 상황을 현명하게 쓰려면 어떻게해야합니까? 이 일을 성사시켜주십시오. 나는 첫 번째 조건에서 if를 시도했지만 성공하지 못했습니다.
<tr height="30" id="user_option">
<td width="300">
<input type="checkbox" id="users" name="cl_user_type[]" value="users" {if $data.cl_user_type=='users'}checked="checked"{/if}/>Users
</td>
<td> <input type="checkbox" id="upload_from_file" name="cl_user_type[]" value="upload_from_file" />Upload From File
</td>
<td>
<input type="checkbox" id="copy_paste_from_excel" name="cl_user_type[]" value="copy_paste_from_excel"/>Copy paste from excel
</td>
</tr>