Message: Undefined property: Start::$config - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Message: Undefined property: Start::$config (/showthread.php?tid=54077) |
Message: Undefined property: Start::$config - El Forum - 08-21-2012 [eluser]Naczu[/eluser] Hi. I am newbie. I have problem. I use the latest version 2.1.2 of codeigniter. I have a controller which is start.php like this. Code: <?php and testview.php file is Code: <html> and in config.php Code: $config['base_url'] = 'http://localhost/codeigniter/'; I got this error... A PHP Error was encountered Severity: Notice Message: Undefined property: Start::$config Filename: controllers/start.php Line Number: 8 Fatal error: Call to a member function item() on a non-object in C:\xampp\htdocs\codeigniter\application\controllers\start.php on line 8 where is the problem ???? Please help me Message: Undefined property: Start::$config - El Forum - 08-21-2012 [eluser]timmahoney[/eluser] I think you need to add this to the top of your controller, in order to get all the stuff CodeIgniter provides Code: public function __construct() Message: Undefined property: Start::$config - El Forum - 08-21-2012 [eluser]Naczu[/eluser] omg yes it worked ... but why O_O ok .. it worked but I couldnt get the $css and $base variables... what is wrong with the start.php controller ? [quote author="timmahoney" date="1345572814"]I think you need to add this to the top of your controller, in order to get all the stuff CodeIgniter provides Code: public function __construct() Message: Undefined property: Start::$config - El Forum - 08-21-2012 [eluser]timmahoney[/eluser] The __construct method automatically runs when the Controller is loaded, and the line parent::__construct() is running the __construct in the CI_Controller class, (the parent) so it's loading all the CodeIgniter stuff like $this->config Message: Undefined property: Start::$config - El Forum - 08-21-2012 [eluser]Naczu[/eluser] ok .. it worked but I couldnt get the $css and $base variables on the testview.php … what is wrong with the start.php controller ? Message: Undefined property: Start::$config - El Forum - 08-21-2012 [eluser]timmahoney[/eluser] The "Start" method you have in there is not getting run automatically. Try this: Code: <?php Message: Undefined property: Start::$config - El Forum - 08-21-2012 [eluser]Naczu[/eluser] aww thank you so much ... you solved my problem . Message: Undefined property: Start::$config - El Forum - 08-21-2012 [eluser]timmahoney[/eluser] Glad I could help! |