• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
get_instance error - Class 'CI_Controller' not found

#1
In my "helper" function in the "application" folder,

PHP Code:
if ( ! function_exists('_return_config_xxx'))
{
    function 
_return_config_xxx(){

 
       $CI =& get_instance();
    return 
$CI->config->item('config_xxx')
    }



I call :
$ CI = & get_instance ();
return $ CI-> config-> item ('XXX');

and I get the following error:

Code:
Fatal error: Class 'CI_Controller' not found in /home/www/aprendermais.render.com.br/html/system/core/CodeIgniter.php on line 369
A PHP Error was encountered

Severity: Error

Message: Class 'CI_Controller' not found

Filename: core/CodeIgniter.php

Line Number: 369

Backtrace:
Reply

#2
We need more information, like your directory structure where are you calling that function / method from?

If you have moved the application and system folders then you have to edit the index.php file and tell it
where they are located.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#3
your helper in in application/helpers/ ?
Reply

#4
You're calling this helper prior to controller instantiation (likely in a pre_system hook, or a core library extension), and you can't use get_instance() in that case because what get_instance() does is to return the controller object.
Reply

#5
(10-05-2017, 03:08 AM)Narf Wrote: You're calling this helper prior to controller instantiation (likely in a pre_system hook, or a core library extension), and you can't use get_instance() in that case because what get_instance() does is to return the controller object.

I agree with the above comment.

If you provide the logs, we can have a look.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


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