I have created a CMS website with codeigniter, now I am trying to make website SITEMAP with php coding, but the code which i have made is not complete. i.e It is not showing all the sub menu data properly
Please look at this image(http://i.stack.imgur.com/xh5WZ.png) According to this image, I am having many other sub menu under Weight training(sub menu of Fitness Exercises) ,but they are not visible. Why they are not visibile?Please guide/help me to solve this issue
My php code
foreach ($query_sitemap as $artrow) {
$datefromsql = $artrow->created_date;
$time = strtotime($datefromsql); ?>
<ul>
<?php echo '<b>'.$artrow->menu_name.'</b>'; ?>
<?php $submenucon=$this->menumodel->fetch_menu_byPid($artrow->id);//i.e select*from menu where parent_id=$mid
if (empty($submenucon)) { ?>
---
<?php
} else {
foreach ($submenucon as $subtrow) {
?>
<?php echo '<li >'.$subtrow->menu_name.'</li><br>'; ?>
<?php
}
}
?>
</ul>
<?php
$i++;
}
} ?>
**My db struture is**
Table: menu
---------------
id PK(primary key)
menu_name .....
content longtext
parent_id int(key to id)
This is an example of the data stored in the table:
Example
----------------
id | menu_name | content | parent_id
----------------------------------------
1 | main 1 | this is main menu 1 | 0 <-- First level menu
2 | main 2 | this is main menu 2 | 0 <-- First level menu
3 | submenu 1 | this is main menu 1's first submenu's item 1 | 1 <-- Second level menu
4 | submenu 1 | this is main menu 1's first submenu's item 2 | 1 <-- Second level menu
5 | submenu 2 | this is main menu 2's first submenu's item 1 | 2 <-- Second level menu