toolman Posted November 15, 2011 Share Posted November 15, 2011 Hi, I have this menu code which displays a drop down menu: <ul> <li><a href="<?php echo URL_PUBLIC; ?>">Home</a></li> <?php function submenu($list, $ul){ if($ul){ echo " <ul>";} foreach($list->children() as $newList){ echo ' <li>'.$newList->link($newList->title, (in_array($newList->slug, explode('/', $newList->url)) ? ' class="current"': null)); if ($newList->childrenCount() > 0) { submenu($newList, true); }else{echo "</li>";} } if($ul){echo " </ul></li>";} } submenu($this->find('/'), false); ?> <br style="clear: left" /> </ul> I am trying to exclude certain menu items based on their slug. I have this code, but can't work it into the above: $omit_pages = array('page1', 'page2'); if (in_array($menu->slug, $omit_pages)) { continue; } Does anyone have any ideas how I can work it in? Thanks Link to comment https://forums.phpfreaks.com/topic/251152-exclude-items-from-menu/ Share on other sites More sharing options...
MasterACE14 Posted November 15, 2011 Share Posted November 15, 2011 $omit_pages = array('page1', 'page2'); if (!in_array($menu->slug, $omit_pages)) { submenu($this->find('/'), false); } no? Link to comment https://forums.phpfreaks.com/topic/251152-exclude-items-from-menu/#findComment-1288220 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.