• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need to integrate navigation

Hi everybody,

I am working in a web application development. In that i want to keep my navigation as a dynamic one. It should 3 level navigation menu by showing the active page.

Please give your suggestions on how to manage this. Is that i need to write any common functions in helper or plugins and calling it in the controller. Or some kind of function directly calling in view.

Kindly let me know your ideas. Thank you.


Check out the Template Parser class (not automatically loaded)


It allows for dynamic creation of menus from a view.

That or you will have to write the php code to take your data that represents the menu, and through some kind of loop, make a string of the data and load it. You can load strings of data, like a view, like this:
$string = $this->output->get_output(); //Gets currently loaded views
$string .= $navigationCode; //$navigationCode should be the variable holding the HTML code of your dynamic navigation
$string = $this->output->set_output(); //Updates the output

I'll be watching this thread... so if you need help, just post back

Hi mlage,

Thanks for your reply.
I am seeing the template parser used for the navigation.
But is it possible to keep this code as general function to be called in all pages.

Now it seems that we need to repeat this navigation code in each page.

Please advise me on this. Thank you.


The keywords of your statement that hurt my eyes to read... "we need to repeat this navigation code in each page"

Programming is beautiful in that one of its purposes is to prevent repeating code. So to answer your question, yes you can keep it as a general function. There are many ways on doing this...

I would look into writing a short library that has one class with the functions you want... then you load that library for whatever controller needs it and call the appropriate functions.

Check out this:

Any other questions, just post back here

as mlage say there are many ways you can do this, if you don't want to use library then you can use base controller put you navigation code in base controller like MY_Controller extend you controller with MY_Controller and call navigation code in your views,

check base controller how they work


2nd check widget there are two type widget available in ignited code section one with CI loader and on as plug in which one you like its up to you both will work great

with CI loader


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.