ThinkPHP3.1.2开启Smarty后模版无法调用注入变量

浏览:1061 发布日期:2013/04/23
3.1.2 - 普通 - 未处理
'URL_HTML_SUFFIX'=>'.html',//统一使用模版后缀名为.html
'TMPL_ENGINE_TYPE'=>'Smarty',//开启smarty模版引擎
'TMPL_ENGINE_CONFIG'=>array(
'template_dir' => TMPL_PATH, //模板目录
//'compile_dir' =>TEMP_PATH , //编译目录
'cache_dir' =>CACHE_PATH, //缓存目录
'caching' => true, //是否启用缓存
'cache_lifetime' =>60*60*24,//缓存时间
)


配置已开启Smarty模版属性

class ProductAction extends Action{
public $model;
public function __construct(){
parent::__construct();
$this->model = M('Product');
}
/**
* 列表显示
*/
public function showAll(){

//$product = M('Product');
$result = $this->model->order('id desc')->select();//倒叙输出
$this->assign('result',$result);
$this->display();
}

以下粗体就无法调用result变量出来

<foreach from="result" id="vo" item="vo">

<tr>
<td>
<input type="checkbox" />
</td>
<td>{$vo.id}</td>
<td><a href="#" title="title">{$vo.name}</a></td>
<td>{$vo.price}</td>
<td>{$vo.count}</td>
<td>
<!-- Icons -->
<a href="__URL__/update/id/{$vo.id}" title="Edit"><img src="__PUBLIC__/admin/images/icons/pencil.png" alt="Edit" /></a>
<a href="__URL__/delete/id{$vo.id}" title="Delete"><img src="__PUBLIC__/admin/images/icons/cross.png" alt="Delete" /></a> </td>
</tr>
</foreach >
评论(
后面还有条评论,点击查看>>