rabbit7777 2017-12-04 07:36
浏览 633

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

配置文件:

 <?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条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 安卓adb backup备份应用数据失败
    • ¥15 eclipse运行项目时遇到的问题
    • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
    • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
    • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
    • ¥50 成都蓉城足球俱乐部小程序抢票
    • ¥15 yolov7训练自己的数据集
    • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
    • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
    • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)