CodeIgniter + Smarty = Error

谁说我不能喝 提交于 2019-12-13 06:19:23

问题


Here's what I did:

  1. Downloaded and unzipped CI
  2. Downloaded and unzipped Smarty in /application/libraries/Smarty-3.1.4
  3. Saved https://github.com/kzhiwei/codeigniter-smarty/blob/master/application/libraries/Smartylib.php to /application/libraries/Smartylib.php (also fixed line 2 to point to the correct folder)
  4. Added Smartylib in autoload libraries
  5. Created a test.tpl and called it from the controller: $this->Smartylib->display('test.tpl');

Now, I'm getting the following error:

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

Any ideas what is wrong?


回答1:


Library references are case sensitive:

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


来源:https://stackoverflow.com/questions/7883300/codeigniter-smarty-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!