Maxic112
10/3/2017 - 6:35 AM

php_function__bitrix_isSectionMenu

php_function__bitrix_isSectionMenu

				function isSectionMenu( $strSectionMenuType = 'left', $useExtFiles = true ){
					global $APPLICATION;
					$strSectionDir = dirname( $_SERVER['SCRIPT_NAME'] );
					$arPath = explode( '/', $strSectionDir );
					$arPath = array_diff( $arPath, array('') );
					$rootPath = realpath( $_SERVER['DOCUMENT_ROOT'] );
					$currentPath = $rootPath . '/';
					$arLastMenu = array();
					foreach ($arPath as $key => $crumb) {
						$currentPath .= $crumb . '/';
						$menuFile = $currentPath . '.' . $strSectionMenuType . '.' . 'menu.php';
						$extMenuFile = $currentPath . '.' . $strSectionMenuType . '.' . 'menu_ext.php';
						if( file_exists( $menuFile ) ){
							if( $useExtFiles && file_exists( $extMenuFile ) ){
								require( $useExtFiles );
							};

							require( $menuFile );

							$arLastMenu = $aMenuLinks;
						};
					};
					return count($arLastMenu);
				};