Welcome Guest, Not a member yet? Register   Sign In
Use CI with a single controller instead of many
#1

[eluser]yabune[/eluser]
Hi,

If I create a CI site with only one controller and one model, and use the routes to route the urls to different functions of the controller, is it worst in terms of performance?

For example, if I have a site with these sections:
- news
- blog
- photos
- about

Instead of creating a controller and model for each section, I have only one controller with a function for each. And the same for the model. And in the routing, I route the urls for each function.

Apart from the layout and design advantages of having multiple controller for each section, is there any disadvantage of having a single controller?

Thank you!
#2

[eluser]WanWizard[/eluser]
Probably not.

It just means that you are going to end up with one huge file, which will take a bit more time to load, and will definately become a nightmare to maintain.
#3

[eluser]yabune[/eluser]
When I call a controller function, it's only that function that is loaded, and not all the class functions, isn't it?
#4

[eluser]Twisted1919[/eluser]
[quote author="yabune" date="1273275963"]When I call a controller function, it's only that function that is loaded, and not all the class functions, isn't it?[/quote]
WRONG .
Entire file is loaded .
#5

[eluser]yabune[/eluser]
[quote author="Twisted1919" date="1273276261"][quote author="yabune" date="1273275963"]When I call a controller function, it's only that function that is loaded, and not all the class functions, isn't it?[/quote]
WRONG .
Entire file is loaded .[/quote]

So, if I put everything in one controller, I'm using more memory when I call a page?
#6

[eluser]WanWizard[/eluser]
Yes.




Theme © iAndrew 2016 - Forum software by © MyBB