samulegood 发表于 2010-4-26 16:02:08

楼主不错哈,顶一哈!

eason 发表于 2010-8-31 13:32:49

$this->Smarty();报错啊 why

zhenphp 发表于 2011-2-16 17:23:02

下了 看看

zhenphp 发表于 2011-2-16 18:10:45

不错标记下

jianlong918 发表于 2011-7-4 10:11:10

{:1_1:}..hao ahh

hellyhao1988 发表于 2012-9-17 17:56:05

使用这个方案会报错:
Uncaught exception 'SmartyException' with message 'PHP5 requires you to call __construct() instead of Smarty()' in /home/work/index/ui/libraries/smarty/sysplugins/smarty_internal_templatebase.php:803

hellyhao1988 发表于 2012-9-18 09:42:38


//APPPATH是入口文件定义的application的目录
require(APPPATH.'libraries/smarty/Smarty.class.php');

class Cismarty extends Smarty {


    /**
      * 构造函数
      *
      * @access public
      * @param array/string $template_dir
      * @return objsmarty obj
      */
    function __construct()
    {   
          parent::__construct();

          // $this->Smarty();

          //ROOT是Codeigniter在入口文件index.php定义的本web应用的根目录
          //在入口文件中加入define('ROOT', dirname(__FILE__);
          $this->template_dir =ROOT . '/template';
          $this->compile_dir=ROOT . '/template_c';
          $this->config_dir   =ROOT . '/config';
          $this->cache_dir    =ROOT . '/cache';
         
    }
   

}

上面这样不会报错,但是没测试widget是否可以用
页: 1 [2]
查看完整版本: CI和smarty结合一个通用方法