![]() |
Controller name as method - 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: Controller name as method (/showthread.php?tid=2864) |
Controller name as method - El Forum - 08-28-2007 [eluser]zdknudsen[/eluser] When you try to access a method with the same name as the controller (e.g. www.example.org/news/news) it shows the index method instead of a 404, even if there is no constructor. Even more annyoingly, if you use the controllername with some of the letters capitalized as the methodname one is simply presented with a white screen. Controller name as method - El Forum - 08-28-2007 [eluser]Michael Wales[/eluser] Because a method with the same name as the controller is treated as the constructor in PHP4. This is by design, so Code Igniter can support as many users as possible (both PHP4 and PHP5 users). Controller name as method - El Forum - 08-28-2007 [eluser]xenon-dev[/eluser] [quote author="Zawk" date="1188352158"]When you try to access a method with the same name as the controller (e.g. www.example.org/news/news) it shows the index method instead of a 404, even if there is no constructor.[/quote] The constructor ALWAYS exists and is run, even if you don't specifically overload it. It's like an idea: you can't see it, or touch it, or feel it, but it's there, it exists and it just works ![]() Controller name as method - El Forum - 09-08-2007 [eluser]zdknudsen[/eluser] I see. But what about my other paragraph? "Even more annyoingly, if you use the controllername with some of the letters capitalized as the methodname one is simply presented with a white screen." |