I am trying to setup an area that is accessible only for the registered users, using Bonfire/CodeIgniter. Per Bonfire documentation, we can use the Authenticated_controller. When I try to extend my controller from Authenticated_controller, I get the error message:
Fatal error: Call to a member function is_ajax_request() on a non-object in D:\xampp\htdocs\bonfire\bonfire\libraries\template.php on line 264
The code that I have is for the controller 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();
}
//--------------------------------------------------------------------
}
Other Warnings that I get are listed below:
ERROR - 2014-08-15 13:10:19 --> Severity: Notice --> Trying to get property of non-object D:\xampp\htdocs\bonfire\bonfire\libraries\template.php 258 ERROR - 2014-08-15 13:10:19 --> Severity: Notice --> Trying to get property of non-object D:\xampp\htdocs\bonfire\bonfire\libraries\template.php 258 ERROR - 2014-08-15 13:10:19 --> Severity: Notice --> Trying to get property of non-object D:\xampp\htdocs\bonfire\bonfire\libraries\template.php 264
The code in template.php where the error occurs:
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 }
I have seen similar error messages and the problem has been not having an object initialized. This one "is_ajax_request()" type error is nowhere to be found and I am not sure how to fix this.
Any help is appreciated.