smarty模板中truncate的使用
来源:互联网 发布:验证json格式 编辑:程序博客网 时间:2024/05/20 00:38
smarty模板中truncate的使用
truncate:截取
1.从字符串开始处截取某长度的字符,默认是80个,你也可以指定第二个参数作为追加在截取字符串后面的文本字串.该追加字串被计算在截取长度中。默认情况下,smarty会截取到一个词的末尾。如果你想要精确的截取多少个字符,把第三个参数改为”true”;
2.例:截取
index.php$smarty = new Smarty;$smarty->assign('articleTitle', 'Two Sisters Reunite after Eighteen Years at Checkout Counter.');$smarty->display('index.tpl');index.tpl:{$articleTitle}{$articleTitle|truncate}{$articleTitle|truncate:30}{$articleTitle|truncate:30:""}{$articleTitle|truncate:30:"---"}{$articleTitle|truncate:30:"":true}{$articleTitle|truncate:30:"...":true}
输出结果:
Two Sisters Reunite after Eighteen Years at Checkout Counter.Two Sisters Reunite after Eighteen Years at Checkout Counter.Two Sisters Reunite after...Two Sisters Reunite afterTwo Sisters Reunite after---Two Sisters Reunite after EighTwo Sisters Reunite after E...
0 0
- smarty模板中truncate的使用
- PHP中Smarty模板的使用
- smarty模板的使用
- MVC中使用smarty模板
- Smarty模板引擎的使用
- php:smarty模板的使用
- Smarty模板引擎的使用
- smarty模板简单的使用
- PHP中模板的使用(phplib和smarty)
- 关于Smarty插件中truncate截取中文乱码的解决方案
- PHP 中使用 Smarty 之初:认识 Smarty 模板引擎
- 【PHP】smarty模板中使用随机数
- PHP Yii框架中使用smarty模板
- smarty模板中使用php函数
- 新浪SAE中如何使用smarty模板
- smarty truncate
- Smarty模板中变量的声明
- smarty模板中,{assign}的作用
- 一个很简单的后退到上一步的思路
- 有序数组:>奇数在前 偶数在后
- 用迭代器指向类型声明变量
- java 字符串转成 json 数组并且遍历
- 分享一个NS3学习思路(ARP发送时间间隔、发送次数修改设置)
- smarty模板中truncate的使用
- 使用Beyond Compare,你需要知道什么?
- JSP语法必备知识
- 【LeetCode-73】Set Matrix Zeroes
- 树的子结构
- objc的字符串变量中拼入宏
- 正则表达式
- Buy Tickets(线段树)
- 贪心算法基本思想和典型例题