classNames and __construct - 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: classNames and __construct (/showthread.php?tid=21249) |
classNames and __construct - El Forum - 08-04-2009 [eluser]Richard Testani[/eluser] I'm trying to figure out what the differences are in the 2 versions. In the following, I've set: $route['default_controller'] = "index"; I know in php4 you use the class name as the construct and in php5 you'd use __construct(). I'm running php5, so it's __construct() for me, yet... Code: class Index extends Controller { Returns file not found. status 404. I'm not sure why. Once I add the following to the Index class it works: Code: public function Index() { classNames and __construct - El Forum - 08-04-2009 [eluser]Dam1an[/eluser] Will naming a controller index not cause a problem as it's the default function... which in this case would also be the constructor? classNames and __construct - El Forum - 08-04-2009 [eluser]Richard Testani[/eluser] Good question, I hadn't thought about it that way - is Index a reserved name?. I'll test it out with a different name. Thanks classNames and __construct - El Forum - 08-04-2009 [eluser]Dam1an[/eluser] It appears so, reserved names |