rabbit7777
rabbit7777
2017-12-04 07:36

CI整合smarty3报错,大神进来帮忙看下

  • php
  • smarty

配置文件:

 <?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');   
$config['theme']        = 'default';   
$config['template_dir'] = APPPATH . 'views';   
$config['compile_dir']  = APPPATH . 'libraries/smarty/templates_c';   
$config['cache_dir']    = APPPATH . 'libraries/smarty/cache';   
$config['config_dir']   = APPPATH . 'libraries/smarty/configs';   
$config['caching']      = false;   
$config['cache_lifetime']     = 60;
$config['use_sub_dirs'] = false;
//子目录变量(是否在缓存文件夹中生成子目录)
$config['left_delimiter'] = '{';
$config['right_delimiter'] = '}';

类文件:

 <?php   
if(!defined('BASEPATH')) EXIT('No direct script asscess allowed');   
require_once(dirname(__FILE__) . '/smarty/Smarty.class.php');  

class CI_Smarty extends Smarty {   
    protected $ci;   
    public function  __construct(){   
        $this->ci = & get_instance();   
        $this->ci->load->config('smarty');//加载smarty的配置文件   
        //获取相关的配置项   
        $this->cache_lifetime = $this->ci->config->item('cache_lifetime');
        $this->caching = $this->ci->config->item('caching');
        $this->config_dir = $this->ci->config->item('config_dir');
        $this->template_dir = $this->ci->config->item('template_dir');
        $this->compile_dir = $this->ci->config->item('compile_dir');
        $this->cache_dir = $this->ci->config->item('cache_dir');
        $this->use_sub_dirs = $this->ci->config->item('use_sub_dirs');
        $this->left_delimiter = $this->ci->config->item('left_delimiter');
        $this->right_delimiter = $this->ci->config->item('right_delimiter');
    }   
}   

访问报错:

A PHP Error was encountered

Severity: Notice

Message: Trying to get property of non-object

Filename: sysplugins/smarty_internal_templatecompilerbase.php

Line Number: 334

Backtrace:

File: /wx_code/application/libraries/smarty/sysplugins/smarty_internal_templatecompilerbase.php
Line: 334
Function: _error_handler

File:/wx_code/application/libraries/smarty/sysplugins/smarty_template_compiled.php
Line: 199
Function: compileTemplate

File: /wx_code/application/libraries/smarty/sysplugins/smarty_template_compiled.php
Line: 98
Function: compileTemplateSource

File: /home/myccf/site_codes/wx_code/application/libraries/smarty/sysplugins/smarty_template_compiled.php
Line: 161
Function: process

File: /wx_code/application/libraries/smarty/sysplugins/smarty_internal_template.php
Line: 184
Function: render

File: /wx_code/application/libraries/smarty/sysplugins/smarty_internal_templatebase.php
Line: 199
Function: render

File: /wx_code/application/libraries/smarty/sysplugins/smarty_internal_templatebase.php
Line: 114
Function: _execute

File: /wx_code/application/controllers/App.php
Line: 24
Function: display

File: /wx_code/index.php
Line: 315
Function: require_once

Fatal error: Call to a member function create() on a non-object in /home/myccf/site_codes/wx_code/application/libraries/smarty/sysplugins/smarty_internal_templatecompilerbase.php on line 334

A PHP Error was encountered

Severity: Error

Message: Call to a member function create() on a non-object

Filename: sysplugins/smarty_internal_templatecompilerbase.php

Line Number: 334

Backtrace:

求教哪里出问题了?

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

0条回答

为你推荐

换一换