Answer the question
In order to leave comments, you need to log in
How to implement a similar menu using php?
Perhaps there are some third-party libraries that implement the mega menu.
While reached only the table consisting of id. title , link , and parent , and down to the recursive method that collects the array.
public function getMegaMenuArray(){
$sth=$this->db->prepare("select * from menu");
$sth->execute();
while($row=$sth->fetch(\core\Database::FETCH_ASSOC)){
if(empty($menu[$row['parent']])){
$menu[$row['parent']]=[];
}
$menu[$row['parent']][]=$row;
}
return $menu;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question