1, capitalize[first character uppercase] Call method:
<?php$smarty->assign (' ArticleTitle ', ' next x-men film, X3, delayed. ');? > Call method :{$articleTitle}{$articleTitle| capitalize}{$articleTitle|capitalize:true} Implementation result :next x-men Film, X3, delayed. Next X-men Film, X3, Delayed. Next X-men Film, X3, Delayed.
2. cat[Connection string]
<?php$smarty->assign (' ArticleTitle ', "Psychics predict world didn ' t end");? > Call Method :{$articleTitle|cat: "Yesterday." implementation result :psychics predict world didn' t end yesterday.
3. date_format[formatted Date]
<?PHP$config[' date '] = '%i:%m%p ';$config[' time '] = '%h:%m:%s ';$smarty->assign (' config ',$config);$smarty->assign (' Yesterday ',Strtotime('-1 day ')));?>This template uses$smarty. Now fetch current time:{$smarty. now|Date_format} {$smarty. Now|date_format: "%d"}{$smarty. Now|date_format:$config.Date}{$yesterday|Date_format} {$yesterday|date_format: "%A,%B%e,%Y"}{$yesterday|date_format:$config. TimeRun Results:Jan1, 202201/01/2202:33PmDec31, 2021Monday, December 1, 202114:33:00
4. regex_replace[Regular Replacement]
<? PHP $smarty->assign ("Zhengze", "hae2525ahwo3w"); change the number in the string to QQ:<div><{$zhengze |regex_replace: "/\d/": "QQ"}></div> running result: Haeqqqqqqqqahwoqqw
5, replace[replacement]
<? PHP $smarty->assign ("Tihuan", "Nice to meet"); replace the letter E with #<div><{$tihuan }></div><div><{$tihuan|replace: "E": "#"}></div> Run Result: Nice to meet Younic# to m# #t
6. truncate[interception]
<? PHP $smarty->assign ("jiequ", "Welcome to Zibo"), intercept 10 characters, 2 *<div><{in the end or sentence $jiequ }></div><div><{$jiequ|truncate:1}></div><div><{$jiequ |truncate:10: "* *"}></div><div><{$jiequ|truncate:10: "* *":true}>< /div><div><{$jiequ|truncate:10: "* *":true:true}></div> Running result: Welcome to Zibo... Welcome** *WELC**zibo
Smarty Variable Adjuster