发新话题
打印

smarty cat连接字符串

smarty cat连接字符串

PHP通过“.”连接字符串,Java通过“+”连接字符串,smarty连接字符串如何实现呢?

查了查手册,发现:smarty连接字符串通过的是关键字:|cat:

例如:

index.php:
$smarty = new Smarty; 
$smarty->assign('articleTitle', "Psychics predict world didn't end");
$smarty->display('index.tpl');
index.tpl:
{$articleTitle|cat:" yesterday."}
OUTPUT:
Psychics predict world didn't end yesterday.

{assign var="h_index" value=$cur_yearmonth.year|cat:"-"|cat:$cur_yearmonth.mon|cat:"-"|cat:$day.day }
[ 本帖最后由 xiexie 于 2012-7-7 14:32 编辑 ]

TOP

发新话题