CodeIgniter Forums
Controller Subfolder or Custom Routes? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Controller Subfolder or Custom Routes? (/thread-3185.html)



Controller Subfolder or Custom Routes? - El Forum - 09-14-2007

[eluser]K-Fella[/eluser]
If I wanted to use www.domain.com/admin/users/edit/user_id would I need to use Controller subfolders or custom routes?


Controller Subfolder or Custom Routes? - El Forum - 09-14-2007

[eluser]Matthew Pennell[/eluser]
Either/or - it's up to you. I use a sub-folder within controllers, particularly for admin functions (where there are lots of sub-controllers all within the same section).


Controller Subfolder or Custom Routes? - El Forum - 09-14-2007

[eluser]Michael Wales[/eluser]
Subfolders will not effect yours URLs.

In your case, I would do some routing, because you don't want a method named users. passing a parameter edit - you want that to be a method itself.

Just setup up your route to point to 'admin/editusers'

Code:
class Admin extends Controller {

  function editusers($id = NULL) {
  }

}



Controller Subfolder or Custom Routes? - El Forum - 09-14-2007

[eluser]K-Fella[/eluser]
Thanks for the replies guys Smile I wasn't sure if one option was better than the other. Seeing as I've not bothered with subfolders so far in the project, I think I'll go the routes way.


Controller Subfolder or Custom Routes? - El Forum - 09-14-2007

[eluser]K-Fella[/eluser]
<offtopic>
Is it just me or does that smiley look more like a rolleyes smiley than a smile smiley!
</offtopic>