Bitrix Site Manager

CMain::GetMenu

CMenu
CMain::GetMenu(
 string type = "left",
 bool use_ext = false,
 mixed template_path = false,
 mixed init_dir = false
)

The method GetMenu returns an instance of the CMenu class. The object returned is initialised by calling the method CMenu::Init. In case of an error, the LAST_ERROR property of the calling object contains the error description.

Parameters

ParameterDescription
type Type of the menu.
Optional; left by default.
use_ext 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 allows you to modify the menu array $aMenuLinks as desired, for example: add menu items.
Optional; false by default.
template_path Path relative to the site root to the menu template.
Optional; false by default, which specifies to search for the template using the algorithm described in the "Menu" section.
init_dir Folder for which the menu is to be built.
Optional; false by default, which means the current folder.

See Also

Example



<?
// 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();
?>