CodeIgniter - Form: Creating Menu LibraryTag: CodeIgniter, framework, MVC, library, menu Category: PHP Frameworkpost: 15 Feb 2008 read: 3,371 CodeIgniter Form Step By Step Tutorial - Part 4: After create simple layout, at this step, we will learn about library. For practice, we put our menu to library. First, create a file named "MyMenu.php" within CodeIgniter\system\application\libraries. Enter following code to that file:
At creating of menu library, we need a class (we give name "MyMenu"). It have a function show_menu(). This function access other CI classes and helpers (URL helper). URL helper will help you make url easier:
This menu, we use <ul> and <li>. We will modify layout of menu use css (at next topic about css). Now, open our controller: books.php within CodeIgniter\system\application\controllers. Update like following code:
If you still don't understand about this code, please read this tutorial series. Next, open "books_menu.php" within CodeIgniter\system\application\views. Replace all code with:
Point your browser to http://localhost/CodeIgniter/index.php/books/main
|
| | Give Your Opinion | Recommend |
|

