#1 September 20, 2016 1:41pm

daansk44
Member
From: Amersfoort, The Netherlands
Registered: September 12, 2016
Posts: 42

Adding an submenu

I have found a lot of things using the last post I made.

But I have a new question.

Well I fixed the menu, with this code

<?
$cms = $cms->getNavByParent(0,5);
foreach($cms as $item) {
print '<li ><a href="'.$item['link'].'">'.$item['title'].'</a></li>';
if (!empty($item['children'])) {
  // foreach ($item['children'] as $submenu) {
  //   print '<ul><li ><a href="'.$submenu['link'].'">'.$submenu['title'].'</a></li>';
  // }

}
?>

But I want to load a specific menu, for example
Home
-Contact
--MAKE TICKET
-FAQ
--HOW LOGIN
--HOW TO UPLOAD something (whatever)

I have a header menu
With
[HOME | CONTACT | FAQ ]

But on the FAQ page I want to load the FAQ menu smile, without thousand foreach loops, is there an more simple solution smile

Daan

--

Offline

#2 September 21, 2016 1:56pm

timbuckingham
Administrator
From: Baltimore, MD
Registered: April 2, 2012
Posts: 978

Re: Adding an submenu

To get two levels down from the top level navigation item (e.g. return all of FAQs descendants when on FAQ, HOW TO LOGIN, or HOW TO UPLOAD):

$toplevel = $cms->getTopLevelNavigationId();
$nav = $cms->getNavByParent($toplevel, 2);

To get just the children of the current page:

$nav = $cms->getNavByParent($bigtree["page"]["id"], 1);

Offline

Board footer

Powered by FluxBB

The Discussion Forum is not available on displays of this size.