feindura 2.0.2 release changes createSubMenu() method

This small release makes it more convienient to add a sub menu to your web site.

I renamed the createSubMenu() method to createSubMenuOfPage().
The new createSubMenu() method will now always return a menu when the current page has a sub menu or the current category is a sub category. This way its much easier to add subMenus in a sidebar.

 
// will create a <ul> menu from the current page, when it has a subcategory or the current subcategory
foreach($feindura->createSubMenu('ul') as $item) {
  echo $item['menuItem'];
}

 

If you have a menu entry and want to add a dropdown menu of the sub category, use the createSubMenuOfPage() method like this:

 
// will create a <ul> menu from the non category (ID 0)
$menu = $feindura->createMenu('category',0,'ul');

// displays the menu
foreach($menu as $item) {
  echo $item['startTag'].$item['link'];
  // when a page has a submenu it will create a <ul> menu inside this <li></li>,
  // which can be used as a CSS dropdown menu. e.g. see http://www.cssnewbie.com/easy-css-dropdown-menus/
  foreach($feindura->createSubMenuOfPage($item['pageId'],'ul') as $subItem) {
    echo $subItem['menuItem'];
  }
  echo $item['endTag'];
}

Download it here!

Buffer