php模板smarty的一些簡單技巧

2023-05-10    分類: 網站建設

好久沒有翻閱以前學習php時候的資料,今天閑來無事打開了下自己以前學習php的記錄文檔,發(fā)現(xiàn)了一些可以和大家分享的技巧,主要都是php模板smarty的一些簡單技巧,分享這些技巧希望對初學smarty的同志有所幫助,可能不是太高深的東西,但是希望大家都能學習下吧,會的總結總結,不會的學習學習。

下面是一些基于smarty簡單的使用方法和技巧總結列表。具體就不一行一行的和大家解釋了。

$smarty=new smarty()
$smarty->template_dir=
$smarty->complie_dir=
$smarty->cache_dir=
$smarty->left_delimiter=
$smarty->right_delimiter-
$smarty->caching=
$smarty->cache_lifetime=
$smarty->assign
$smarty->display

include file=""

cat:""
default:
indent:5:" "
replace:"author":"icyzhl"
lower:
capitalize
date_format:"%Y年%m月%d日"
assign var= value=
html_checkboxs name= values= checked= output= separator=
html_radios name= values= checke= output= separator=
html_select_date
if else /if
section name=xx loop=$news step=1 start max show //$news[xx].

$smarty.section.xx.index
1. index: 上邊我們介紹的"循環(huán)下標",默認為0
2. index_prev: 當前下標的前一個值,默認為-1
3. index_next: 當前下標的下一個值,默認為1
4. first: 是否為先進下循環(huán)
5. last: 是否為后一個循環(huán)
6. iteration: 循環(huán)次數(shù)
7. rownum: 當前的行號,iteration的另一個別名
8. loop: 后一個循環(huán)號,可用在section塊后統(tǒng)計section的循環(huán)次數(shù)
9. total: 循環(huán)次數(shù),可用在section塊后統(tǒng)計循環(huán)次數(shù)
10. show: 在函數(shù)的聲明中有它,用于判斷section是否顯示

foreach from=$array item=xx //$xx.
foreachelse
/foreach

簡單說到這里吧,成都網絡公司在這里感謝您閱讀至此,希望這些php_smarty技巧能幫上您。如果您還對smarty有任何疑問,也可以撥打我們公司網站建設咨詢電話02886922220進行咨詢。

網頁標題:php模板smarty的一些簡單技巧
鏈接分享:http://www.muchs.cn/news13/258863.html

成都網站建設公司_創(chuàng)新互聯(lián),為您提供外貿建站、做網站、App開發(fā)、網站導航、電子商務、標簽優(yōu)化

廣告

聲明:本網站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)

綿陽服務器托管