capitalize [首字母大写]
count_characters [计算字符数] cat [连接字符串] count_paragraphs [计算段落数]count_sentences [计算句数]count_words [计算词数]date_format [时间格式]default [默认]escape [转码]indent[缩进]lower[小写 ]nl2br[换行符替换成<br />]regex_replace[正则替换]replace[替换]spacify[插空]string_format[字符串格式化]strip[去除(多余空格)]strip_tags[去除html标签]truncate[截取]upper[大写]wordwrap[行宽约束]
{$cook_hotelArr|count} [数组最大下标]
{section name=s loop=$stu}
{$stu[s].name}
{sectionelse}
无内容
{/section}
$smarty->cache_dir = "/caches/"; //缓存目录$smarty->caching = true; //开启缓存,为flase的时侯缓存无效$smarty->cache_lifetime = 60; //缓存时间
$smarty->display('cache.tpl', cache_id); //创建带ID的缓存
$smarty->clear_all_cache(); //清除所有缓存
$smarty->clear_cache('index.htm'); //清除index.tpl的缓存$smarty->clear_cache('index.htm',cache_id); //清除指定id的缓存 index.htm<div>{insert name="get_time"}</div>
index.php
function insert_get_time(){
return date("Y-m-d H:m:s");}literal 数据将被当作文本处理,此时模板将忽略其内部的所有字符信息. 该特性用于显示有可能包含大括号等字符信息的 javascript 脚本{literal} <script language=javascript> ..... </script>{/literal}
strip标记中数据的首尾空格和回车. 这样可以保证模板容易理解且不用担心多余的
空格导致问题.一般放在HTML代码的开始和结束
**** 同一个域名下的文件缓存处理
比如分站同一个文件,加载时多个参数就可解决
$smarty->display("hotel.htm",$cityId);
posted on 2011-11-03 15:36 阅读( ...) 评论( ...)