Documentation

GetMenu

CMenu
CMain::GetMenu(
 string type = "left",
 bool MenuExt = false,
 mixed template = false,
 mixed InitDir = false
)

The method returns returns an instance of the CMenu class. The object returned is initialised by calling the method CMenu::Init. Non-static method.

Parameters

ParameterDescription Available from version
type Menu type.
Optional parameter; left by default.
MenuExt If true, the menu is built using files .menu type.menu_ext.php in addition to the standard files .menu type.menu.php. The _ext files allow you to modify the menu array $aMenuLinks as desired, for example: add menu items with values from information blocks.
Optional; false by default.
template Path relative to the site root to the menu template.
Optional parameter; false by default.
InitDir Folder for which the menu is to be built.
Optional parameter; false by default, which means the current folder.

See Also

Examples of use

<?
// display menu of the type "left"
//  use files .menu type.menu_ext.php
// explicitly specify the template and
// the folder to build the menu for

$obMenu = $APPLICATION->GetMenu(
    "left",
    true,
    "/bitrix/php_interface/".SITE_ID."/left.menu_template.php", 
    SITE_DIR
    );

// display the menu
echo $obMenu->GetMenuHtml();
?>


© «Bitrix24», 2001-2022
Up