{html_radios}
鏄竴涓
鑷畾涔夊嚱鏁锛岀敤浜庡垱寤篐TML鐨勫崟閫夋缁勫拰鎻愪緵鏁版嵁銆
璇锋敞鎰忛粯璁ら変腑鐨勬儏鍐点
鍙傛暟鍚嶇О | 绫诲瀷 | 蹇呴夊弬鏁 | 榛樿鍊 | 璇存槑 |
---|---|---|---|---|
name | string | No | radio | 鍗曢夋鐨勫悕绉 |
values | array | 蹇呴夛紝闄ら潪浣跨敤options灞炴 | n/a | 鍗曢夋鐨勫兼暟鎹 |
output | array | 蹇呴夛紝闄ら潪浣跨敤options灞炴 | n/a | 鍗曢夋鐨勬樉绀烘暟鎹 |
selected | string | No | empty | 閫変腑鐨勯」 |
options | 鏁扮粍 | 蹇呴』, 闄ら潪浣跨敤values 鍜 output灞炴 | n/a | 鍗曢夋鐨勫-鏄剧ず鐨勬暟缁 |
separator | string | No | empty | 瀛楃涓蹭腑鍒嗛殧姣忛」鐨勫瓧绗 |
assign | string | No | empty | 灏嗗崟閫夋鏍囩璧嬪煎埌鏁扮粍锛岃屼笉鏄緭鍑 |
labels | boolean | No | TRUE |
鍦ㄨ緭鍑轰腑澧炲姞<label>鏍囩 |
label_ids | boolean | No | FALSE |
缁<label> 鍜 <input>璁剧疆ID灞炴 |
escape | boolean | No | TRUE |
灏嗚緭鍑轰腑鐨/杞崲(鍊兼绘槸浼氳杞崲) |
蹇呴』璧嬪肩殑灞炴ф槸
values
鍜output
, 闄ら潪浣跨敤options
鏉ヤ唬鏇裤鍏ㄩ儴鐨勮緭鍑烘爣绛鹃兘閬靛惊XHTML瑙勫垯銆
浠讳綍涓嶅湪涓婇潰鍒楄〃涓殑閿煎灞炴э紝閮戒細琚緭鍑哄埌
<input>
鏍囩涓綔涓哄睘鎬у拰鍊笺
Example聽8.13.聽{html_radios}绗竴涓緥瀛
<?php $smarty->assign('cust_ids', array(1000,1001,1002,1003)); $smarty->assign('cust_names', array( 'Joe Schmoe', 'Jack Smith', 'Jane Johnson', 'Charlie Brown') ); $smarty->assign('customer_id', 1001); ?>
妯℃澘锛
{html_radios name='id' values=$cust_ids output=$cust_names selected=$customer_id separator='<br />'}
Example聽8.14.聽{html_radios}绗簩涓緥瀛
<?php $smarty->assign('cust_radios', array( 1000 => 'Joe Schmoe', 1001 => 'Jack Smith', 1002 => 'Jane Johnson', 1003 => 'Charlie Brown')); $smarty->assign('customer_id', 1001); ?>
妯℃澘锛
{html_radios name='id' options=$cust_radios selected=$customer_id separator='<br />'}
涓婇潰鐨勪袱涓緥瀛愰兘杈撳嚭锛
<label><input type="radio" name="id" value="1000" />Joe Schmoe</label><br /> <label><input type="radio" name="id" value="1001" checked="checked" />Jack Smith</label><br /> <label><input type="radio" name="id" value="1002" />Jane Johnson</label><br /> <label><input type="radio" name="id" value="1003" />Charlie Brown</label><br />
Example聽8.15.聽{html_radios} 鏁版嵁搴撲緥瀛(濡 PEAR 鎴 ADODB):
<?php $sql = 'select type_id, types from contact_types order by type'; $smarty->assign('contact_types',$db->getAssoc($sql)); $sql = 'select contact_id, name, email, contact_type_id ' .'from contacts where contact_id='.$contact_id; $smarty->assign('contact',$db->getRow($sql)); ?>
杈撳嚭锛
{html_radios name='contact_type_id' options=$contact_types selected=$contact.contact_type_id separator='<br />'}