Welcome Guest, Not a member yet? Register   Sign In
Best Practice - Should I load a view for content or process the data in the controller
#1

[eluser]deco10[/eluser]
On the left side of my site there is a menu. The content of this menu changes depending on the page but typically there is 5 of the 10 possible items displayed (so some pages have links on the menu that are on other pages). Currently I load the view into the "leftpane" and run a switch statement to determine what content gets printed in the menu.

I'm making some changes and I'm wondering if I should control this content in the controller or if I'm in the right to do it a separate view file and load it. I realize its not a huge deal either way, I'm just looking for what would be the proper MVC method.

In my leftpane_view I have all the links at the top loaded into an assoc. array so I can change them easily.

What do you think?


Thanks for input! Smile
#2

[eluser]Phil Sturgeon[/eluser]
If you do it in the controller you'd end up doing it every time. I would be tempted to create a plugin, or extend the Controller class (search MY_Controller) to give you a method of adding PHP to every pageload.




Theme © iAndrew 2016 - Forum software by © MyBB