• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Still a bit confused about how I should divide up my controllers

#1
[eluser]D_Williams[/eluser]
I'm new to CI and the MVC way of doing things in general. I have some half finished project that's rapidly becoming a mess and it seems like CI would really clean it up. I've watch a bunch of tutorial videos and read most of the documentation, but I'm still not sure where I should draw the lines as far as my controllers go.

My project is relatively simple, it will have all the basic home/register/login/forgot password/verify email pages that are present on so many websites, plus a few site specific pages and admin pages. Should I have a controller for each "page", or should I make something like a "site" controller with a method for each one of my pages, or somewhere in-between?

Also, another small tag-along question I have about CI: If my script is going to be a redistributable package, what's the preferred way to distribute it? Should I package it all together with CI's system folder or should I just have my application folder available for download and let the installer worry about app management and such?

#2
[eluser]frist44[/eluser]
With regards to code break-up, I usually create a controller for specific functions like the one you mention. Because your application sounds relatively simple, it makes sense to be able to use a URL like www.domain.com/login for the login page. In the past, I have created a user controller, and had all those user account functions in there, that works too (www.domain.com/user/login). I think that many moderns applications like Rails are moving towards the RESTful interface, so it should make sense what the function is doing based on the URL.

Hope this helps!


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.