codeigniter & cjax framework, fatal error class 'CI_Controller' not found

Posted by Martin on Stack Overflow See other posts from Stack Overflow or by Martin
Published on 2012-10-15T17:55:57Z Indexed on 2012/10/20 5:03 UTC
Read the original article Hit count: 647

Filed under:
|

I'm having this weird error with Codeigniter 2.1.3 and latest cjax for codeigniter. Weird thing is, when I download the latest codeigniter, and latest cjax framework for codeitniger and copy to my friends server, and call:

domain.com/ajax.php?test/test2 

to show the test ajax examples ... it works like a breeze, but when I do this on my server, I get server error (even tho, we both have same php version and such). Server then throws in error log file this error:

PHP Fatal error: Class 'CI_Controller' not found in /hosting/www/domain.com/www/application/response/test.php on line 3

Now, I've read thru stackoverflow with people having this problem and solving by changing the construct and calling CI_Controller instead of Controller. But I already do that ... - I mean it's in the basic example that is suppose to work without touching the code, and it does, just not on my domain for some crappy reason.

Ajax.php from cjax framework for codeingter should load controller from folder response, named test and call function test2, which looks like this (the actual file named test.php):

class Test extends CI_Controller {

function __construct()
{
    parent::__construct();
}

/**
 * 
 * ajax.php?test/test/a/b/c
 * 
 * @param unknown_type $a
 * @param unknown_type $b
 * @param unknown_type $c
 */
function test($a = null,$b = null, $c = null)
{
    $this->load->view('test', array('data' => $a .' '.$b.' '.$c));
}

/**
 * ajax.php?test/test2
 * 
 * Here we are testing out the javascript library.
 * 
 * Note: the library it is  not meant to be included in ajax controllers - but in front-controllers,
 * it is being used here for the sake of simplicity in testing.
 */
function test2()
{
    $ajax = ajax();

    $ajax->update('response','Cjax Works');

    $ajax->append('#response','<br /><br />version: '.$ajax->version);

    $ajax->success('Cjax was successfully installed.', 5);

    //see application/views/test2.php
    $this->load->view('test2');
}

I was hoping someone could bring some light into this problem - or maybe someone has already experienced it?

Thanks for your time! Mart

© Stack Overflow or respective owner

Related posts about AJAX

Related posts about codeigniter-2