Controller Setup - 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 Setup (/showthread.php?tid=20253) |
Controller Setup - El Forum - 07-03-2009 [eluser]Chad Tomkiss[/eluser] Hi, I have just started working with CodeIgniter, and firstly, what a framework! However, I am a little curious as to whether I am setting the controllers up correctly. I am comfortable with having: example.com/community/team and having Code: class Community extends Controller { However, what would be the best way of achieving: example.com/community/resources/screensavers Also, as functions cannot contain dashes, how would you achieve urls such as example.com/community/meet-the-team for example. I have looked through the forum/searched google, but I cannot find a solution that is viable. Kind regards, Chad Controller Setup - El Forum - 07-03-2009 [eluser]Thorpe Obazee[/eluser] [quote author="Chad Tomkiss" date="1246628928"] Also, as functions cannot contain dashes, how would you achieve urls such as example.com/community/meet-the-team for example. I have looked through the forum/searched google, but I cannot find a solution that is viable. Kind regards, Chad[/quote] I searched the forums and found these: http://ellislab.com/forums/viewthread/114539/ http://ellislab.com/forums/viewthread/102725/ Controller Setup - El Forum - 07-03-2009 [eluser]Chad Tomkiss[/eluser] Hi bargainph, Thank you for your reply. I had seen the thread, and I did think of Code: function resources($page) but I was not sure if this was the best way. Kind regards, Chad Controller Setup - El Forum - 07-03-2009 [eluser]xwero[/eluser] The dashes problem only kicks in if the dashed segment is a controller or method name. If the dashes are in the parameter(s) you have no problem. Controller Setup - El Forum - 07-03-2009 [eluser]Chad Tomkiss[/eluser] I am not sure if the above code is going to work. As if you were to have resources/page/page2/page3 then it would seem long winded to pass in $page1, $page2, $page3 to the function. Would it be advisable to take the approach of just having 1 class 1 function. So rather than community/resources/desktop/widgets having community/resources community/desktop community/widgets and then just link to widgets in the desktop view etc? Kind regards, Chad Controller Setup - El Forum - 07-03-2009 [eluser]slowgary[/eluser] Any way will work, use whatever you feel more comfortable with. Maybe you should consider NOT using a community controller, but instead putting your controllers into a community subfolder. Then your controllers could be team and resources. This would allow you to have something like: Code: team/contact Just another idea to add to the pile. Welcome to the forums |