smarty中变量调节器

来源:互联网 发布:折800淘宝入驻条件 编辑:程序博客网 时间:2024/05/16 16:13

主要学习了几个变量调节的内容,

capitalize (主要功能是把变量中首写的变成大写的)主要代码<{$cap|capitalize}> ;

count_characters (功能是计算变量中的字符数) 主要代码是<{$cap|count_character:ture}>(加true的意思是计算字符中的空格) ; 

cat (功能为连接字符串) <{$cap|cat:""}> ; 

count_paragraphs (功能为计算段数) <{$cap|count_paragraph}>;

count_sentences(功能为计算句数)  <{$cap|count_sentences}> ;

count_words(功能为计算词数) <{$cap|count_words}> ; 

date_format (功能为格式化当前系统日期/时间)  <{$smarty.now|date_format:"  %Y-%m-%d  %H:%M:%S"}> 

 default (功能为默认值)  <{$cap|default}>

escape(功能为编码) 用于html转码,url转码,在没有转码的变量上转换单引号,十六进制转码,十六进制美化,或者javascript转码。默认是html转码

<{$cap|escape:"html"}> <{* escape $ "  '  < >*}>   <{$cap|escape:"htmlall"}>