【发布时间】:2015-06-15 01:50:30
【问题描述】:
我在 Codeigniter 中安装了 Smarty,但它并没有真正工作。这是我所做的:
但我还在库中放了另一个文件:parser.php,这是一个用于解析的库(我之前用 smarty 使用过,效果很好)
-
Codeigniter 的 autoload.php 上写道:
$autoload['libraries'] = array('parser','smarty'); -
在主控制器上我写了这个函数来测试:
public function index() { $this->data['d'] = 2; $this->parser->parse('base/test.tpl', $this->data); }
但结果是没有错误显示,我看到了模板中写的变量“d”:
{$d}
所以我有两个问题:
如果我像以前在其他项目中那样安装 smarty,为什么我看不到变量值?
如果有错误,如何启用查看?
【问题讨论】:
-
答案 2:在 CoideIgniter 的根文件夹中,打开
index.php文件并在第 21 行附近设置define('ENVIRONMENT', 'development');。这将使您能够显示任何错误、警告、通知消息。
标签: codeigniter parsing templates smarty