-
Smarty中foreach的index、iteration的使用
-
smarty:字符串连接 cat
示例:
index.php:
$smarty = new Smarty;
$smarty->assign(‘aTitle’, “Psychics predict world didn’t end”);
$smarty->display(‘index.tpl’);index.tpl:
{$aTitle|cat:” yesterday.”|cat:” go on.”}
OUTPUT:
Psychics predict world didn’t end yesterday. go on.
-
解决模板中js与smarty冲突的问题
采用smarty技术,JS代码就会不乐意,介绍一种两全其美的方法,采用标签:{literal}{/literal}
代码如下:
{literal}
<script>
这里就可以任意填写JS代码了。
</script>
{/literal}
