欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

smarty學(xué)習(xí)筆記之常見代碼段用法總結(jié)

 更新時(shí)間:2016年03月19日 09:20:39   作者:phpsome  
這篇文章主要介紹了smarty學(xué)習(xí)筆記之常見代碼段用法,結(jié)合實(shí)例形式總結(jié)分析了Smarty常見代碼段的含義與使用方法,需要的朋友可以參考下

本文實(shí)例講述了smarty常見代碼段。分享給大家供大家參考,具體如下:

1、

<select >
  {html_options values=$cust_ids selected=$customer_id output=$cust_names}
</select>

說明:生成下拉菜單。values=一個(gè)數(shù)組,數(shù)組元素為列表值 selected=一個(gè)值,這個(gè)是默認(rèn)的列

表值 output=一個(gè)數(shù)組,數(shù)組元素為顯示的列表值

{html_checkboxes values=$cust_ids checked=$customer_id 
output=$cust_names separator="<br/>"}

說明:復(fù)選框。同上;separator="<br />"指以<br />分隔每個(gè)復(fù)選按鈕的字符串

{html_radios values=$cust_ids checked=$customer_id
output=$cust_names separator="<br/>"}

說明:單選按鈕

2、

{counter start=0 skip=2 print=ture}

說明:計(jì)數(shù)器,其后使用時(shí),以0 開始,每次增加 2 。

3、

{section loop=$data}
  <tr bgcolor="{cycle values="#eeeeee,#d0d0d0"}">
  <td>{$data[rows]}</td>
  </tr>
{/section}

說明:輪回返回?cái)?shù)組元素(或一個(gè)數(shù)列)值

4、

{assign var="name" value="Bob"}
The value of $name is {$name}.//The value of $name is Bob。

說明:賦值

5、

{fetch file="http://www.myweather.com/68502/" assign="weather"}

說明:fetch 用于從本地文件系統(tǒng)、HTTP或FTP上取得文件并顯示文件的內(nèi)容. 如果文件名稱 

以"http://"開頭,將取得該網(wǎng)站頁面并顯示. 如果文件名稱以"ftp://"開頭,將從ftp服務(wù)器取得

該文件并顯示.

6、

{html_image file="../path/relative/to/currdir/pumpkin.jpg"
border="1" height="100" width="100" alt="圖片" href="1.html"}

說明:圖片

7、

{html_select_date}

說明:創(chuàng)建日期下拉菜單. 它可以顯示任意年月日

{html_select_time}

說明:用于創(chuàng)建時(shí)間下拉菜單. 它可以顯示任意時(shí)分秒

8、

{html_table loop=$data cols=4 table_attr='border="0"'
tr_attr=$tr td_attr=$td}

說明:以$data數(shù)組元素形成一個(gè)4列的表。table_attl為表格屬性,tr_attr為行屬性,td_attr

為列屬性

9、

{math equation="x + y" x=$height y=$width}

說明:數(shù)學(xué)運(yùn)算函數(shù)

10、

{mailto address="me@domain.com" text="send me some mail"}

說明:生成電子郵件鏈接

11、

{popup}

說明:創(chuàng)建javascript彈出窗口,使用前必須先調(diào)用 popup_init 函數(shù)

希望本文所述對大家基于smarty模板的PHP程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論