Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional CodeIgniter ISBN: 978-0-470-28245-8
This is the forum to discuss the Wrox book Professional CodeIgniter by Thomas Myer; ISBN: 9780470282458
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional CodeIgniter ISBN: 978-0-470-28245-8 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 18th, 2008, 02:39 PM
Registered User
 
Join Date: Dec 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Controllers

This question is perhaps better suited for a specific MVC forum, but I hope I can get an answer here, since I learned MVC with the book: how do the levels of abstraction work in controllers?
For models it's simple: each table has its model file, with the functions you want to perform in it.
For views its equally simple: each page corresponds to a view file.
For controllers I don't see it so clearly. When should something be included as a function of the welcome (default) controller? When should it be placed in a separate controller? When should it be placed in a sub directory of the controller directory?
Is there a definite answer to these questions or is it more of a personal choice?
Thank you for the help!
William
Reply With Quote
  #2 (permalink)  
Old March 16th, 2009, 10:13 AM
Wrox Author
 
Join Date: May 2008
Location: Austin, TX, USA.
Posts: 53
Thanks: 0
Thanked 5 Times in 5 Posts
Default

It's a bit of a personal choice. For me, if I needed to do something repeatedly (say, for example, importing a CSV file) I would put that into a helper or library so I could use it from multiple controllers. If however, what I was facing was an organizational issue (say, an admin area of a website) I would use subfolders to keep things organized (instead of just putting all my functions into one controller).

Controllers are just a way to organize your code. They translate into routes. Once you get your head around that, you can pretty much do what feels best (of course, if you are handing your code off to someone else, you have to be merciful to them too!).
__________________
Thomas Myer
Author, Professional CodeIgniter
http://www.tripledogs.com
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Rails: move flash between controllers ciderpunx Ruby 2 March 7th, 2006 08:25 PM



All times are GMT -4. The time now is 07:34 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.