I want to write a new Joomla template. How can I obtain the number of parent elements in my menu?
So far i tried this:
$app = JFactory::getApplication(); $menu = $app->getMenu(); $menu_items = $menu->getItems('menutype', 'topmenu'); // var_dump($menu_items); foreach($menu_items as $i) { if($i->parent == 1) { $itemCounter++; } }
but at the end i get the wring number :(