Smarty-变量调节器
来源:互联网 发布:哪个软件淘宝返利最高 编辑:程序博客网 时间:2024/06/07 19:52
变量调节器
1.capitalize 将变量的首字母大写
原变量内容<{$cap|escape:"htmlall"}>
应用后内容<{$cap|capitalize}>
2.count_characters 计算变量的字符个数
不计空格:<{$cap|count_characters}>
计算空格:<{$cap|count_characters:true}>
3.cat 给字符串连接特殊字符
<{$cap|cat:"@#$"}>
4.count_paragraphs 计算段落个数
<{$cap|count_paragraphs}>
5.count_words 计算单词个数
<{$cap|count_words}>
6.count_sentences 计算句子的个数
<{$cap|count_sentences}>
7.利用date_format格式化当前系统的日期/时间
当前系统时间是:<{$smarty.now|date_format}:"%Y-%m-%d %H:%M:%S"> 注意:时(H)分(M)秒(S)之间用:分开
8.string_format 格式参数 %d(十进制整数) %x(十六进制整数) %o(八进制整数) %u(无符号显示)
通过%md格式化一个实数 <{$num|string_format:"%10d"}>
通过%m.n格式化一个实数<{$num|string_format:"%10.2f"}>(四舍五入,保留两位,总长度为10)
通过%e格式化一个实数<{$num|string_format:"%4.2e"}>(科学技术法表示)
9.indent 缩进
<{$cap|indent:4:"$nbsp;"}>
10.upper 转换成大写
<{$cap|upper}>
11.lower 转换成小写
<{$cap|lower}>
12.replace 替换
<{$cap|replace:"php":"java"}>(将php替换成java)
13.truncate 截取字符串
<{$cap|truncate:6:"***":true}>(截取6个字符,后三位是***)
14.spacify 半角变全角
- smarty变量调节器
- smarty变量调节器
- Smarty变量调节器
- smarty变量调节器
- smarty之变量调节器
- Smarty变量调节器
- Smarty变量调节器
- smarty变量调节器
- smarty中变量调节器
- Smarty----变量调节器
- smarty变量调节器
- smarty的变量调节器
- smarty变量调节器
- Smarty变量调节器
- Smarty中变量调节器
- Smarty变量调节器
- Smarty 变量调节器
- smarty变量调节器
- oracle 优化问题
- Smarty变量调节器&缓存
- Drupal Workflow实现的相关文章
- struts第一步--HelloWorld项目创建
- C#与SQLite的操作介绍
- Smarty-变量调节器
- 触发器的定义与使用
- IPV6概述(2)
- Debug 和 Release 编译方式的本质区别
- POJ2762 Going from u to v or from v to u?
- 数组与指针的艺术(转载)
- C# 使用sqlite 轻量级数据库
- 有关 SQL游标 的那些事 11/14
- 集合一