Welcome Guest, Not a member yet? Register   Sign In
Sidebars and sub-controllers..
#1

[eluser]Korhal[/eluser]
Hey guys,

I am very new to code igniter having started my first project only a week or two back. I have one main problem currently which I am struggling to find an answer I can use. Here goes..

I have a view which currently calls a common sidebar view on most of my pages. I am incorrectly (i know) calling data from models to populate this sidebar. As the sidebar is shared over many pages i do not have to remember to tell each controller to pass this data to the view.

Now i am running into a problem where i need to make the controller dynamic.. IE.. The forum, news pages and user management pages all need unique sidebars while the rest of the pages still require the default one.

My own thought was to have the controller call another controller named sidebar object buffering the output, which then could be passed down to the view when the main page is rendered.. After some research i am told this breaks the MVC pattern..

So now i am at a loss.. How should this be done? Please remember im a noob Smile.

Thanks in advance..
Korhal
#2

[eluser]InsiteFX[/eluser]
Do a search for HMVC and Widgets.

InsiteFX
#3

[eluser]Pascal Kriete[/eluser]
If you wanted to do this natively, the easiest solution is to create a sidebar library and then just call the corresponding method in there.
#4

[eluser]Korhal[/eluser]
Why did I not think of that.. Thank you, i will give both ideas a try..

Lee




Theme © iAndrew 2016 - Forum software by © MyBB