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="#" ti
<td>{$vo.price}</td>
<td>{$vo.count}</td>
<td>
<!-- Icons -->
<a href="__URL__/update/id/{$vo.id}" ti
<a href="__URL__/delete/id{$vo.id}" ti
</tr>
</foreach >
