Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
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
 
Old March 16th, 2009, 10:13 AM
Wrox Author
 
Join Date: May 2008
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





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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.