Welcome Guest, Not a member yet? Register   Sign In
implementing a common account bar
#1

[eluser]AtlantixMedia[/eluser]
Hello,

ok, I'm in the process of implementing a control panel system where a navigation bar would be shown across all pages. the bar would have the following items:

1)My Account
2)My Ratings
3)My Items
etc

every section is gonna have its own controller, and the navigation item the user is browsing will have to be kind of highlighted on the bar. how would you implement this without having to recreate the bar on each controller?

thanks
#2

[eluser]gon[/eluser]
You could have the account bar markup in a separate view.
This view should get as data the section, and render the bar accordingly.

Code:
function show_section() {
   $account_bar_data['selected_section'] = $selected_section;
   $account_bar_html = $this->load->view("account_bar_view", $account_bar_data, true);

   $data['account_bar'] = $account_bar_html;
   $this->load->view("section_view", $data);
}

You can build a helper that does get the account bar HTML automatically, if you don't want to repeat the code on every controller.




Theme © iAndrew 2016 - Forum software by © MyBB