您的位置:首页 > 其它

smarty 中 变量调节器(1)

2012-11-12 15:29 225 查看
变量调节器用于变量,自定义函数和字符串。请使用‘|’符号和调节器名称应用调节器。变量调节器由赋予的参数值决定其行为。参数由‘:’符号分开。

capitalize

将变量里的所有单词首字大写。

count_characters[字符计数]

计算变量里的字符数

cat[连接字符串]

将cat里的值连接到给定的变量后面.

count_paragraphs[计算段数]

计算变量里的词数

date_format[格式化日期]

Parameter Position Type Required Default Description

1 string No %b %e, %Y This is the format for the outputted date.

输出日期的格式。

2 string No n/a This is the default date if the input is empty.

输入为空时的默认时间格式。

This formats a date and time into the given strftime() format.

Dates can be passed to Smarty as unix timestamps, mysql timestamps or any string made up of month day year (parsable by strtotime).

Designers can then use date_format to have complete control of the formatting of the date.

If the date passed to date_format is empty and a second parameter is passed, that will be used as the date to format.

格式化从函数strftime()获得的时间和日期。

Unix或者mysql等的时间戳记(parsable by strtotime)都可以传递到smarty。

设计者可以使用date_format完全控制日期格式。

如果传给date_format的数据是空的,将使用第二个参数作为时间格式。

escape[编码]

Parameter Position Type Required Possible Values Default Description

1 string No html,htmlall,url,quotes,hex,hexentity,javascript html This is the escape format to use.

使用何种编码格式。

This is used to html escape, url escape, escape single quotes on a variable not already escaped, hex escape, hexentity or javascript escape. By default, the variable is html escaped.

用于html转码,url转码,在没有转码的变量上转换单引号,十六进制转码,十六进制美化,或者javascript转码。默认是html转码。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: