php - Drupal template, verify that the page is a menu item -
helló!
i want examine actual page in menu. want drupal template (page.tpl.php). example:
if ($page_is_a_menuitem): echo "this page in menu"; else: echo "this page not in menu"; endif;
because if page in menu want highlight title.
sorry bad english.
try
this return menu list :- menu_get_menus(true)
like this
array ( [menu-footer-menu] => footer menu [main-menu] => main menu [management] => management [navigation] => navigation [user-menu] => user menu )
and want main menu inside list use this
$tree = menu_tree_all_data('main-menu')
this return in main-menu in items
otherwise use code
$path = current_path(); $selected_menu= ''; $menu = menu_link_get_preferred($path = null, $selected_menu = null);
$menu
return current page manu detail after want
echo "this menu ".$menu['menu_name'] .' , menu title '.$menu['title'];
Comments
Post a Comment