Rendering dynamic multilevel menu in CodeIgniter

Posted on

Hello, I’m Sutriman and I’ll share about web programming best practice, especially about dynamic multi menu and CodeIgniter Framework. As you know, CodeIgniter is one of the best PHP framework by EllisLab. There is so many library included in a package. In addition you can find too many library and helper in internet by thirdparty.

I’ve been talk about some libraries that maybe will help us to speed up the work. Now, I’ll tell you how to setup the dyanmic multilevel menu using simple library that you cand find it in Github.

Now, just follow the steps;

  1. Clone or Download the library here. The package is not only library, but its completly the CodeIgniter project.
  2. So, If you just want to know the sample about this library, you can extract the .zip file in your docroot. Or if you using git, just clone in to docroot.
  3. Open your SQL Client, and create new database with name anything that you want.
  4. Import ci_multilevel_menu.sql into your new database.
  5. And then, just look at the database config of the app in application/config/database.php , and settup as your local setting. Fill the username and password as you have, and the database name as your new database that you created before.
  6. open the app in browser and you got the example of multilevel menu project.

Another way, how to combine the library into our existing project? It’s too simple with this library. You just need to;

  1. Copy and paste application/config/multi_menu.php to your own project
  2. Copy and paste application/libraries/Multi_menu.php to your own project

More about this library, you can read theĀ  documentation in github. The documentaion is complete and will help you to customize the library.