CodeIgniter + Smarty =错误

时间:2011-10-25 00:02:29

标签: php codeigniter smarty codeigniter-2

这就是我的所作所为:

  1. 已下载并解压缩CI
  2. /application/libraries/Smarty-3.1.4
  3. 中下载并解压缩Smarty
  4. https://github.com/kzhiwei/codeigniter-smarty/blob/master/application/libraries/Smartylib.php保存到/application/libraries/Smartylib.php(也是固定第2行指向正确的文件夹)
  5. 在自动加载库中添加了Smartylib
  6. 创建了test.tpl并从控制器中调用它:$this->Smartylib->display('test.tpl');
  7. 现在,我收到以下错误:

    Fatal error: Call to a member function createTemplate() on a non-object in C:\wamp\www\myapp\application\libraries\Smarty-3.1.4\libs\sysplugins\smarty_internal_templatebase.php on line 47
    

    任何想法有什么不对?

1 个答案:

答案 0 :(得分:1)

Library references区分大小写:

$this->load->library('smartylib');
$this->smartylib->display('test.tpl');