您的位置:首页 > 产品设计 > 产品经理

work_note 2016年2月18日, PM 12:21:29

2016-02-18 12:22 369 查看
smarty 技巧:

时间格式化:
{|$v.add_time|date_format:"%Y-%m-%d %H:%M"|}


中文文字裁剪
{|$declaration|truncate_cn:120:'...'|}


如果为空值,默认值 {|$v.commentNum|default:’0’|}

传递数组:1、在model中建立数组:

```
public $_field = array(
'title'=>array(
1=>'教授',
2=>'博士',
3=>'先生',
4=>'女士',
5=>'小姐'
)
)
```
2、在controller中 传到smarty:


$temp['field'] = M('mn_user')->_field;


3、在模版中使用:
```
<td>称呼</td> <td>{|$field['title'][$data['title']]|}</td>
```


工作记录

去掉文章 show_time ok

去掉 face ok

UE编辑器的 替换 全部更改为在后台替换
$result['content'] = str_replace('\"', '"', $result['content']); ok
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  php-smarty