Welcome Guest, Not a member yet? Register   Sign In
Just need an advice about controllers
#1

[eluser]Rushino[/eluser]
Hello,

I was wondering if this would be better to have one controller per page.. or one controller for a section of pages ?

Here an exemple, i have a controller called Frontend and it contains theses methods : index, login, createAccount.

Would it be better to have.. an account controller, a login controller and the frontend that serve only the main page or having these threes method in the same controller can do the job ?

Which one is bad practice ?

Thanks.
#2

[eluser]oppenheimer[/eluser]
I have been creating one controller per tab. I also put all the views for that controller into a subfolder. It is just my way of grouping.

I think the overall answer depends on you and how you want to organize your site.
#3

[eluser]Rushino[/eluser]
Do you consider an admin area as a different app ?
#4

[eluser]toopay[/eluser]
[quote author="Rushino" date="1303761459"]Do you consider an admin area as a different app ?[/quote]
That depends on how big your app. if you're about build some huge project, then yes. Otherwise, some backend modules will enough.

About controller, i ussually put it into its groups, based by databases and routing concept. Lets say i'am about to build a simple blog, then i probably will have 'Posting','Comment','Tag','Archive' and 'Home' controller. With that, i'll have an intuitive url and grouped function based by its model ;-)
#5

[eluser]Rushino[/eluser]
Interresting. However the problem is that my website have 3 area.. home, user and admin area. I may have an account controller sitting in both three areas. (user registration, account management, account admin management)

So i think this may be more interesting having one app for each area. Was just wondering how this could be archieved ? i am afraid the session or database state won't be keep with this setup.
#6

[eluser]InsiteFX[/eluser]
Maybe one app like this?
Code:
application
  -- controllers
   ---- admin
   ---- manage
   ---- user

  -- views
  ---- admin
  ---- manage
  ---- user
I would also look into HMVC Modules.

InsiteFX




Theme © iAndrew 2016 - Forum software by © MyBB