CodeIgniter Forums
Controller Structure - many functions or seperate - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Controller Structure - many functions or seperate (/showthread.php?tid=45710)



Controller Structure - many functions or seperate - El Forum - 10-02-2011

[eluser]newuser2[/eluser]
I am always on the lookout for best practices and one of the things that has been bothering me has been controller layout.

For example, there is a 'Wiki' controller with at least 6 functions along the lines of

1. wiki-add
2. wiki-delete
3. wiki-view-history
4. wiki-edit
5. ....

In my routes, I have setup for each URL to point back to its specific function within this 'wiki' controller. It works fine the way it is, although I'm not sure if I should separate each function in its controller. The code is <40 lines for some functions.

After having a look at a real CI example, I think I should split them up.