CodeIgniter Forums
One Controller - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forum-21.html)
+--- Thread: One Controller (/thread-29704.html)

Pages: 1 2


One Controller - El Forum - 04-19-2010

[eluser]$ilovephp[/eluser]
Hi everyone, I would like to ask your opinion about having only ONE CONTROLLER for the entire project.

Personally, i found these advantageous since we do not have to load the same libraries on different Controllers. Probably just have different function that will load different views.

Is it feasible?


One Controller - El Forum - 04-19-2010

[eluser]theshiftexchange[/eluser]
Its all about code re-usability and the ease of adjusting sections.

If you are doing a 'big' website with lots of functionality, then one controller would get bloated.

Multiple controllers makes it easier to modify functionality...


One Controller - El Forum - 04-19-2010

[eluser]$ilovephp[/eluser]
thank you for your opinion., i appreciate it


One Controller - El Forum - 04-19-2010

[eluser]Tominator[/eluser]
When you are loading the same libraries, helpers etc. you can just add it to autoloading ...
So I am for: 'More Controllers'


One Controller - El Forum - 04-19-2010

[eluser]$ilovephp[/eluser]
[quote author="Tominator" date="1271687386"]When you are loading the same libraries, helpers etc. you can just add it to autoloading ...
So I am for: 'More Controllers'[/quote]

You have a good point. Thank you.


One Controller - El Forum - 04-19-2010

[eluser]n0xie[/eluser]
Pretty much depends on the situation doesn't it.


One Controller - El Forum - 04-19-2010

[eluser]John_Betong[/eluser]
Initiaily I went down the one controller route until I discovered how to extend controllers with MY_Controller.

Now I have a bloated MY_Controller.php library Sad
 
 
 


One Controller - El Forum - 04-19-2010

[eluser]$ilovephp[/eluser]
thank you for your reply guys! really appreciated it.. now, i think, i have to redesign the structure of my Controller. Smile


One Controller - El Forum - 04-19-2010

[eluser]ranjeet_sangle[/eluser]
If you are working on a single website with a team then its not feasible to keep a single controller because all the members cant work on a single file simultaneously.

So its necessary to divide your project into multiple controllers.

Also according to me website having a single controller gets too bulky..

I think there must be a separate controller for each distinct entity of your website /project...(similar to objects)


One Controller - El Forum - 04-19-2010

[eluser]n0xie[/eluser]
[quote author="ranjeet_sangle" date="1271705959"]If you are working on a single website with a team then its not feasible to keep a single controller because all the members cant work on a single file simultaneously. [/quote]
That's what you use a SCM for.