+ -
当前位置:首页 → 问答吧 → smarty在模版文件可以用php源码吗

smarty在模版文件可以用php源码吗

时间:2011-04-06

来源:互联网

smarty在模版文件可以用php源码吗

作者: liujianliang   发布时间: 2011-04-06

还没听说有写源码的啊

作者: zhangyanhe162   发布时间: 2011-04-06

那他的扩展性不好啊

作者: liujianliang   发布时间: 2011-04-06

直接用insert标签调用你要实现的方法类似{insert name='cart_info'}就行了

作者: zhangyanhe162   发布时间: 2011-04-06

可以,在new smarty之后,设置一个属性为true就可以了。
属性名字忘了,你自己查查

作者: dingsongtao   发布时间: 2011-04-06

貌似是:
$smarty->php_handling = SMARTY_PHP_ALLOW ;
但这个刚才看手册,是执行{php}{/php}之间的代码。
我1月以前才用过,不记得到底是哪个属性了。
那个是可以直接执行<?php ?>里的内容

作者: dingsongtao   发布时间: 2011-04-06


$smarty->allow_php_templates = true;  
应该是这个 然后在模板中直接
{php}CODE ........{/php} 就可以了

作者: JustBeBetter   发布时间: 2011-04-06