Get Smarty

Donate

Donate Bitcoin Bitcoin
Paypal

Smarty Icon

You may use the Smarty logo according to the trademark notice.

Smarty Template Engine Smarty Template Engine

For sponsorship, advertising, news or other inquiries, contact us at:

Sites Using Smarty

Buy cheap eyeglasses from Cheapglasses123.com and save up to 80%.

Buy prescription glasses from www.australiaglasses.com and save.

Cheap Glasses Now On Sale at GlassesPeople.com. Starts At $7.95.

Where to buy discount wedding dresses and cheap smart dresses free shipping - Weddingdresstrend.com

Brautkleider auf Topwedding.de

Find free files to download on allwhatyouwant.net

Looking For Affordable Wedding Dresses 2015 at Best Prices On TDBridal.com

Shop high quality cheap prom dresses on Dresswe.co.uk

Buy New Arrival Cheap Prom Dresses 2015 at JDBRIDAL Prom Dress Store

Advertisement

{html_checkboxes}

{html_checkboxes}鏄竴涓 鑷畾涔夊嚱鏁锛岀敤浜庡垱寤篐TML鐨勫閫夋缁勫拰鎻愪緵鏁版嵁銆 璇锋敞鎰忛粯璁ら変腑鐨勬儏鍐点

鍙傛暟鍚嶇О 绫诲瀷 蹇呴夊弬鏁 榛樿鍊 璇存槑
name string No checkbox 澶氶夋鐨勫悕绉
values array 蹇呴夛紝闄ら潪浣跨敤options灞炴 n/a 澶氶夋鐨勫兼暟鎹
output array 蹇呴夛紝闄ら潪浣跨敤options灞炴 n/a 澶氶夋鐨勬樉绀烘暟鎹
selected string/array No empty 閫変腑鐨勯」锛堜竴涓垨澶氫釜锛
options associative array 蹇呴』, 闄ら潪浣跨敤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 灏嗚緭鍑轰腑鐨/杞崲(鍊兼绘槸浼氳杞崲)
  • 蹇呴』璧嬪肩殑灞炴ф槸valuesoutput, 闄ら潪浣跨敤options鏉ヤ唬鏇裤

  • 鍏ㄩ儴鐨勮緭鍑烘爣绛鹃兘閬靛惊XHTML瑙勫垯銆

  • 浠讳綍涓嶅湪涓婇潰鍒楄〃涓殑閿煎灞炴э紝閮戒細琚緭鍑哄埌<input>鏍囩涓綔涓哄睘鎬у拰鍊笺

Example聽8.6.聽{html_checkboxes}


<?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_checkboxes name='id' values=$cust_ids output=$cust_names
   selected=$customer_id  separator='<br />'}

  

鎴栬匬HP浠g爜锛


<?php

$smarty->assign('cust_checkboxes', array(
                                     1000 => 'Joe Schmoe',
                                     1001 => 'Jack Smith',
                                     1002 => 'Jane Johnson',
                                     1003 => 'Charlie Brown')
                                   );
$smarty->assign('customer_id', 1001);

?>

  

妯℃澘鏄細


{html_checkboxes name='id' options=$cust_checkboxes
   selected=$customer_id separator='<br />'}

  

涓婇潰涓や釜渚嬪瓙鐨勮緭鍑猴細


<label><input type="checkbox" name="id[]" value="1000" />Joe Schmoe</label><br />
<label><input type="checkbox" name="id[]" value="1001" checked="checked" />Jack Smith</label>
<br />
<label><input type="checkbox" name="id[]" value="1002" />Jane Johnson</label><br />
<label><input type="checkbox" name="id[]" value="1003" />Charlie Brown</label><br />

  

Example聽8.7.聽 鏁版嵁搴撲緥瀛(渚嬪 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, contact_type_id, contact '
       .'from contacts where contact_id=12';
$smarty->assign('contact',$db->getRow($sql));

?>

  

杈撳嚭锛


{html_checkboxes name='contact_type_id' options=$contact_types
        selected=$contact.contact_type_id separator='<br />'}


鍙傝 {html_radios}{html_options}

Comments
No comments for this page.
Post a Comment
All comments are moderated. Support questions are ignored, use the forums instead.
Author:
Email: (not shown)
What is 18 plus 12? (Are you human?)

Advertisement