Controller Setup |
[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
[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/
[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
[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.
[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
[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 |
Welcome Guest, Not a member yet? Register Sign In |