Welcome Guest, Not a member yet? Register   Sign In
developing a control panel system
#1

[eluser]AtlantixMedia[/eluser]
Hello,

I'm developing a control panel system and was wondering what would be the best way to go about it. Ideally, I would like to have sections as:

My Profile
My Ratings
My Favorites
My Comments
My Buddies
etc

now I want to make this in such a way that I can use the same system with different projects. Of course, not all projects will need a My Buddies or a My Favorites section. what would be the best way to approach this:

1) have one controller MyAccount with different functions for each section and use re-routing $route['My_Ratings'] = "myaccount/myratings";

OR

2)have one controller for each section of the control panel

thanks
#2

[eluser]xwero[/eluser]
I think because you are thinking about not using some of the sections option 2 will be the better choice. That way you can see in your file structure if a module is added or not. If you use option 1 you will have to disable the method somehow.
#3

[eluser]AtlantixMedia[/eluser]
well, I was thinking about creating a table with a Show field for each section so that I can query that to determine what are the enabled sections for each particular project. if I do that, the only advantage of option 2 over option 1 would be less code to load. am I correct?
#4

[eluser]kevinprince[/eluser]
I would agree that separating the application out is better, with having a separate controller for each core area. This enables to you deploy features as they become ready, reduces complex code etc.
#5

[eluser]xwero[/eluser]
If you go for option 1 you need to do more than only select which section is available or not because the methods could be found hacking the url. You can prevent that by prefixing the not used methods with an underscore or adding a redirect on the first line of a method. So you would have to change the controller per site. If you have a few sites using that code it's going to become hard to memorize the changes.

The filesize is less if you split it into different controllers but it won't affect the loading too much (keeping the code in one file).
#6

[eluser]AtlantixMedia[/eluser]
thanks for the responses so far




Theme © iAndrew 2016 - Forum software by © MyBB