CodeIgniter Forums
why this error? - 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: why this error? (/showthread.php?tid=50579)

Pages: 1 2


why this error? - El Forum - 03-30-2012

[eluser]osgaldor[/eluser]
I'm creating test controllers and everything had been working okay until this last function I wrote to test the url helper. I'm now getting this error:
Fatal error: Undefined class constant 'CI_Controller' in C:\wamp\www\codeigniter\CodeIgniter_2.1.0\application\controllers\dorjeboard.php on line 5

on line 5 is the parent::CI_Controller; call in the constructor. WTH?


why this error? - El Forum - 03-30-2012

[eluser]InsiteFX[/eluser]
Code:
parent::CI_Controller
// should be
parent::__construct();



why this error? - El Forum - 03-30-2012

[eluser]osgaldor[/eluser]
THANKS!!!


why this error? - El Forum - 03-30-2012

[eluser]osgaldor[/eluser]
isthat two underscores?__


why this error? - El Forum - 03-30-2012

[eluser]InsiteFX[/eluser]
Yes, both have double underscores.
Code:
public function __construct()
{
    parent::__construct();
}



why this error? - El Forum - 03-30-2012

[eluser]osgaldor[/eluser]
Ok, that worked, but it just loaded my next view appended on to the same page. I'm using the url helper, how do I get it to completely reload the page?


why this error? - El Forum - 03-30-2012

[eluser]osgaldor[/eluser]
Never mind. I have a big booboo in my HTML.


why this error? - El Forum - 03-30-2012

[eluser]osgaldor[/eluser]
So for the constructor you don't name it the same name as the class? I named it the class name, not __construct();


why this error? - El Forum - 03-30-2012

[eluser]InsiteFX[/eluser]
It should be the way I showed you above that is the PHP 5 constructor.

Naming the constructor with the class name is PHP 4 way.



why this error? - El Forum - 03-30-2012

[eluser]osgaldor[/eluser]
Ok. Thanks. I've been watching some older tutorials I guess.