Welcome Guest, Not a member yet? Register   Sign In
Call to a member function load() on a non-object when autoloading config files at CI3
#1

I'm working in a small project with CI 3.0. I have set up `/application/config/autoload.php` for autoload app config file as follow:

PHP Code:
$autoload['config'] = array('myappcfg'); 

Then at controller constructor I'm doing the following:
PHP Code:
   protected $facebookSession;

 
   public function __construct()
 
   {
 
       $this->facebookSession FacebookSession::newAppSession(
 
           $this->config->item'facebook_app_id' ),
 
           $this->config->item'facebook_app_secret' )
 
       );
 
   
But I'm getting this notice:
Code:
A PHP Error was encountered Severity: Notice Message: Undefined
property: ShareFacebook::$config Filename:
controllers/ShareFacebook.php Line Number: 16

   Backtrace:
       File: /var/www/html/dts/myapp/application/controllers/ShareFacebook.php
           Line: 16
           Function: _error_handler
   
           File: /var/www/html/dts/myapp/index.php
           Line: 292
           Function: require_once
   
       Fatal error: Call to a member function load() on a non-object in /var/www/html/dts/myapp/application/controllers/ShareFacebook.php on line 16
Can any tell me what I'm doing wrong? Why I can't access `$this->config` at controller if config file is autoloaded?
Reply


Messages In This Thread
Call to a member function load() on a non-object when autoloading config files at CI3 - by reynierpm - 04-02-2015, 08:18 PM



Theme © iAndrew 2016 - Forum software by © MyBB