и мой код выглядит так. < /P>
private $Section = array();
function _menu($root)
{
$this->db->select('id,title,p_id');
$this->db->Where('p_id',$root);
$this->db->Where('status','active');
$this->db->Where('type','page');
$this->db->order_by('sort');
$query = $this->db->get('pages');
foreach ($query->result() as $row)
{
$this->Section[] = '
- ';
$this->Section[] = ' - ';
$this->Section[] = anchor('site/page/'.$row->id.'#cont_main',$row->title);
$this->_menu($row->id);
$this->Section[] = '';
$this->Section[] = '
}
$query->free_result();
return $this->Section;
}
//get menu tree
function MenuTree()
{
return $this->_menu(0);
}
< /code>
В выше _menu () Если на NAV имеет двое или более детей, то он не отображается, потому что источник, заполненный им, дает дополнительный
и [*]menu 1 sub2
Подробнее здесь: https://stackoverflow.com/questions/464 ... ults-in-co
Мобильная версия