![]() |
Help Create sub menu from database! - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Help Create sub menu from database! (/showthread.php?tid=53863) Pages:
1
2
|
Help Create sub menu from database! - El Forum - 08-12-2012 [eluser]uqmeebi[/eluser] hello all gurus! i need create sub menu from database but i dont know how? please help me. example: 1 menu item | 2 menu item | 3 menu item| 4 menu item 1.1 sub item 1.2 sub item 1.3 sub item 1.4 sub item Help Create sub menu from database! - El Forum - 08-13-2012 [eluser]Egill Th[/eluser] I'm not sure what you're asking for but to my understanding you are looking for something like this. There may be some errors but it should work in theory. controller Code: <?php view Code: <?php Help Create sub menu from database! - El Forum - 08-13-2012 [eluser]Krystian[/eluser] you need to create table like this id label parent_id so the entries for you example would be 1 | menu_item_1 | 0 | 2 | sub 1 menu_item_1 | 1 | 3 | sub 2 menu_item_1 | 1 | 4 | sub 3 menu_item_1 | 1 | 5 | sub 4 menu_item_1 | 1 | 6 | menu_item_2 | 0 | 7 | menu_item_3 | 0 | 8 | menu_item_4 | 0 | and you need to proper print it and style it Help Create sub menu from database! - El Forum - 08-13-2012 [eluser]uqmeebi[/eluser] [quote author="Krystian" date="1344857300"]you need to create table like this id label parent_id so the entries for you example would be 1 | menu_item_1 | 0 | 2 | sub 1 menu_item_1 | 1 | 3 | sub 2 menu_item_1 | 1 | 4 | sub 3 menu_item_1 | 1 | 5 | sub 4 menu_item_1 | 1 | 6 | menu_item_2 | 0 | 7 | menu_item_3 | 0 | 8 | menu_item_4 | 0 | and you need to proper print it and style it [/quote] thx but i don't understand how create MODEL for query please create simple file for example. Help Create sub menu from database! - El Forum - 08-13-2012 [eluser]LonelyWolf[/eluser] Hi all, excuse my little english AND please don't hurt, i found codeigniter only yesterday evening. This is what i'm doing and at this stage there's nothing to insert voices in the menĂ¹ use phpmyadmin or any other client to your database. I've created a quick library to accomplish this, still required a db table. The table: Code: CREATE TABLE IF NOT EXISTS `navigation` ( The main menĂ¹ supposed to be with father=0, sub menu items will have the relative item id as father. In application/libraries/Navigationmenu.php Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); Load in your controller: Code: $this->load->library('navigationmenu'); Show in your pages: Code: echo $this->navigationmenu->generate(0); ToDo: * Display fathers menu item when showing submenu * Anything to manage menu items * clear the code Edit: Corrected link generation url Help Create sub menu from database! - El Forum - 08-13-2012 [eluser]InsiteFX[/eluser] PHP Dynamic Menu - Just save to database instead Help Create sub menu from database! - El Forum - 08-13-2012 [eluser]uqmeebi[/eluser] [quote author="InsiteFX" date="1344869787"]PHP Dynamic Menu - Just save to database instead [/quote] sorry but it's not solution. we need MVC structure for codeigniter. Help Create sub menu from database! - El Forum - 08-13-2012 [eluser]uqmeebi[/eluser] [quote author="Egill Th" date="1344854984"]I'm not sure what you're asking for but to my understanding you are looking for something like this. There may be some errors but it should work in theory. controller Code: <?php view Code: <?php please create full MVC script for visualization. Help Create sub menu from database! - El Forum - 08-13-2012 [eluser]TWP Marketing[/eluser] [quote author="uqmeebi" date="1344877271"] please create full MVC script for visualization.[/quote] Ok, then you want to post your request in the jobs forum and ask someone to design this for you, for pay. Help Create sub menu from database! - El Forum - 08-13-2012 [eluser]uqmeebi[/eluser] [quote author="TWP Marketing" date="1344878393"][quote author="uqmeebi" date="1344877271"] please create full MVC script for visualization.[/quote] Ok, then you want to post your request in the jobs forum and ask someone to design this for you, for pay.[/quote] if i need this i make this. but i don't. and up script don't work. |