• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
porting i18n library to 2.0 - CI_Controller not found

On the IRC channel, somebody gave me the hint that it might be a version error, but well.. I don't know. It concerns the following library:


With some minor bugfixing, the code does what's expected and prescribed. But this is not exactly what I want to have. I was trying to modify the code so it does what I want.
For that I tried getting an instance of $CI in function MY_lang(), just after the construct.

function MY_Lang()
        global $CFG;
        global $URI;
        global $RTR;
        $CI =& get_instance();

this gives the following error:
Quote:Fatal error: Class 'CI_Controller' not found in /**myproject**/system/core/CodeIgniter.php on line 210

Anyone got an idea what I'm doing wrong?
If you look in the code of the extension, you can see
that a CI instance is being retrieved in another function,
and that never fails. However... that function is never used.

Add this at the bottom of your config.php file - application/config/config.php
| -------------------------------------------------------------------
|  Native Autoload - by Phil Sturgeon.
| -------------------------------------------------------------------
| Nothing to do with config/autoload.php, this allows PHP autoload to work
| for base controllers and some third-party libraries.
| If using HMVC you do not need this! HMVC will autoload.
| Place this code at the bottom of your application/config/config.php file.
function __autoload($class)
    if (strpos($class, 'CI_') !== 0)
        @include_once(APPPATH . 'core/' . $class . EXT);


I already found the answer;
I already added that piece of code actually.

I am trying to do "$CI =& get_instance();"
before the __construct(), is finished. Someone helped me debugging,
and it seems that the Controller class is not yet loaded, so that's why
the call fails on : CI_Controller::get_instance()

CodeIgniter User Guide Hooks!


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.