http://www.smarty.net/http://smarty.php.net/manualPHP
obj_smarty->cache_lifetime = 60 * 60 * 24;//-1:缓存从不过期,0:每次执行缓存总是被重新建立 } 2.循环,section,sectionelse <!!sectionelse!!> 用来表示传入的数组变量为空时对模板进行的处理。 <!!section name=on e loop=smarty.section.on e.total!!> //display the number of iterations that this section will loop <!!arr_result!!> <input type="checkbox" name="<!!arr_result[on e].value|inarray:arr_values) !!>checked<!!/if!!>/><!!arr_result!!> <option value="<!!selectedvalue !!>selected<!!/if!!>><!!sam.adurl!!>"> <img src="upload/images/<!!sam.adurl!!>" title="<!!sam.adtitle|substrgb:'0':'20':''!!></a> <!!/table_foreach!!> 4.包含文件,include <!!include file="header.tpl"!!> 5.不解析,literal <!!literal!!> 这里是js或css,模板不解析 <!!/literal!!> 6.条件判断,if,elseif,else <!!if articleTitle|substrgb:"0":"23":".."!!> <!!contact!!> <!!cust_ids selected=customer_id options=cust_options output=cust_names!!> </select> 14:换行替换,nl2br 换行符替换成<br /> <!!articleTitle|strtolower!!> 19:获取字符串,fetch 获取字符串 int_cache_id = sprintf('%X', crc32("index.html")); if( !obj_smarty->assign("str_date",date("h:i:s")); } arrParams ) { return arrParams["lid"]."-andy-".
本文由来源 21aspnet,由 javajgs_com 整理编辑,其版权均为 21aspnet 所有,文章内容系作者个人观点,不代表 Java架构师必看 对观点赞同或支持。如需转载,请注明文章来源。