smarty學習筆記之常見程式碼片段用法總結,smarty學習筆記_PHP教程

來源:互聯網
上載者:User

smarty學習筆記之常見程式碼片段用法總結,smarty學習筆記


本文執行個體講述了smarty常見程式碼片段。分享給大家供大家參考,具體如下:

1、

  {html_options values=$cust_ids selected=$customer_id output=$cust_names}

說明:產生下拉式功能表。values=一個數組,數組元素為列表值 selected=一個值,這個是預設的列

表值 output=一個數組,數組元素為顯示的列表值

{html_checkboxes values=$cust_ids checked=$customer_id output=$cust_names separator="
"}

說明:複選框。同上;separator="
"指以
分隔每個複選按鈕的字串

{html_radios values=$cust_ids checked=$customer_idoutput=$cust_names separator="
"}

說明:選項按鈕

2、

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

說明:計數器,其後使用時,以0 開始,每次增加 2 。

3、

{section loop=$data}    {$data[rows]}  {/section}

說明:輪迴返回數組元素(或一個數列)值

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 用於從本地檔案系統、HTTP或FTP上取得檔案並顯示檔案的內容. 如果檔案名稱

以"http://"開頭,將取得該網站頁面並顯示. 如果檔案名稱以"ftp://"開頭,將從ftp伺服器取得

該檔案並顯示.

6、

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

說明:圖片

7、

{html_select_date}

說明:建立日期下拉式功能表. 它可以顯示任意年月日

{html_select_time}

說明:用於建立時間下拉式功能表. 它可以顯示任意時分秒

8、

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

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

為列屬性

9、

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

說明:數學運算函數

10、

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

說明:產生電子郵件連結

11、

{popup}

說明:建立javascript快顯視窗,使用前必須先調用 popup_init 函數

希望本文所述對大家基於smarty模板的PHP程式設計有所協助。

您可能感興趣的文章:

  • Ajax+smarty技術實現無重新整理分頁
  • Zend Framework實現Zend_View整合Smarty模板系統的方法
  • Codeigniter中整合smarty和adodb的方法
  • PHP檔案快取smarty模板應用執行個體分析
  • yii,CI,yaf架構+smarty模板使用方法
  • smarty進階特性之對象的使用方法
  • smarty進階特性之過濾器的使用方法
  • php實現smarty模板無限極分類的方法
  • smarty簡單應用執行個體
  • Smarty使用自訂資源的方法
  • smarty中常用方法執行個體總結
  • Smarty最簡單實現列表奇偶變色的方法
  • Smarty foreach控制迴圈次數的一些方法
  • CodeIgniter中使用Smarty3基本配置

http://www.bkjia.com/PHPjc/1111892.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/1111892.htmlTechArticlesmarty學習筆記之常見程式碼片段用法總結,smarty學習筆記 本文執行個體講述了smarty常見程式碼片段。分享給大家供大家參考,具體如下: 1、 select {htm...

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.