Welcome Guest, Not a member yet? Register   Sign In
How many controllers?
#1

[eluser]clintonbeattie[/eluser]
Hi,

Because I'm new to codeigniter I want to learn about best practices.

Currently I set up many functions in my welcome controller. For example...

function index() = home page
function about() = about page
function gallery() = gallery page

Is this the best way to use the MVC framework or should I be creating separate controllers for each page. For example...

welcome.php = home page
about.php = about page
gallery.php = gallery page

Thanks for any advice!!!

Best,
C
#2

[eluser]stuffradio[/eluser]
My rule of thumb is, if the page is similar to some other pages, I group those in one controller. For example, if you were doing login/logout and register, I would group those in one controller because they are similar.

function register()
function login()
function logout()
#3

[eluser]clintonbeattie[/eluser]
Cool. Thanks.

Other opinions welcome.
#4

[eluser]Colin Williams[/eluser]
Generally you want one controller per resource.
#5

[eluser]Italo Domingues[/eluser]
Hello, I agree with the Colin Williams, but I advise that before you start development, you do an analysis and documentation, even if it is simple, so you can have an overview of what you implement, and design the main features that your system must have, so is easy you define groups of functions, also the example that gave Colin Williams.

Good luck.
#6

[eluser]mamen[/eluser]
i Think Use One Controller and some Function

Big Grin




Theme © iAndrew 2016 - Forum software by © MyBB