Bonfire - Authenticated_controller - 致命错误:在非对象上调用成员函数is_ajax_request()

时间:2014-08-15 11:19:32

标签: php codeigniter controller bonfire

我正在尝试使用Bonfire / CodeIgniter设置只能为注册用户访问的区域。根据Per Bonfire文档,我们可以使用Authenticated_controller。当我尝试从Authenticated_controller扩展我的控制器时,我收到错误消息:

  

致命错误:在第264行的D:\ xampp \ htdocs \ bonfire \ bonfire \ libraries \ template.php中的非对象上调用成员函数is_ajax_request()

我的代码是控制器boffice:

<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

/**
 * boffice controller
 */
class Boffice extends Authenticated_Controller
{
    public $ci;
//--------------------------------------------------------------------

/**
 * Constructor
 *
 * @return void
 */
public function __construct()
{
    parent::__construct();
    $this->ci =& get_instance();
    $this->load->library('form_validation');
    $this->lang->load('boffice');

    $this->load->model('pan/pan_model', null, true);
    $this->load->model('activities/activity_model');                

    Assets::add_module_js('boffice', 'boffice.js');
    Template::set_theme("jumbotron");
}

//--------------------------------------------------------------------


/**
 * Displays a list of form data.
 *
 * @return void
 */
public function index()
{

    Template::render();
}

//--------------------------------------------------------------------



}

我得到的其他警告如下:

  

错误 - 2014-08-15 13:10:19 - &gt;严重性:通知 - &gt;试图获取非对象的属性D:\ xampp \ htdocs \ bonfire \ bonfire \ libraries \ template.php 258   ERROR - 2014-08-15 13:10:19 - &gt;严重性:通知 - &gt;试图获取非对象的属性D:\ xampp \ htdocs \ bonfire \ bonfire \ libraries \ template.php 258   ERROR - 2014-08-15 13:10:19 - &gt;严重性:通知 - &gt;试图获取非对象的属性D:\ xampp \ htdocs \ bonfire \ bonfire \ libraries \ template.php 264

发生错误的template.php中的代码:

255     public static function render($layout=NULL)
256 {
257     $output = '';
258     $controller = self::$ci->router->class;
259
260     // We need to know which layout to render
261     $layout = empty($layout) ? self::$layout : $layout;
262
263     // Is it in an AJAX call? If so, override the layout
264     if (self::$ci->input->is_ajax_request())
265     {
267         $layout = self::$ci->config->item('template.ajax_layout');
268
269         $controller = NULL;
270     }

我见过类似的错误消息,问题是没有初始化对象。这个&#34; is_ajax_request()&#34;类型错误无处可寻,我不知道如何解决这个问题。

感谢任何帮助。

0 个答案:

没有答案