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}OUTPUT: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...
我知道这个,可是不行,我要{if {$articleTitle|truncate:1:\"\":true} != \'-\'}+{if}这样不行
试试下面:{if $articleTitle.0 != \'-\'}+{if}{if $articleTitle[0] != \'-\'}+{if}