T
T
Tatiana2016-03-03 00:36:07
1C-Bitrix
Tatiana, 2016-03-03 00:36:07

How to add arbitrary links to the menu in Bitrix?

The situation is this:
there is a menu that is 90% of the menu for the information block, but it should also have several links on the second level that lead to other pages of the same site.
with what can it be done?
code from _ext:

<?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true) die();
$aMenuLinksExt = array();
$arSections = CCache::CIBlockSection_GetList(array("SORT" => "ASC", "ID" => "ASC", "CACHE" => array("TAG" => CCache::GetIBlockCacheTag(CCache::$arIBlocks[SITE_ID]["aspro_allcorp_content"]["aspro_allcorp_our-offers"][0]), "MULTI" => "Y")), array("IBLOCK_ID" => CCache::$arIBlocks[SITE_ID]["aspro_allcorp_content"]["aspro_allcorp_our-offers"][0], "ACTIVE" => "Y", "GLOBAL_ACTIVE" => "Y", "ACTIVE_DATE" => "Y"));
$arSectionsByParentSectionID = CCache::GroupArrayBy($arSections, array("MULTI" => "Y", "GROUP" => array("IBLOCK_SECTION_ID")));
$arItems = CCache::CIBlockElement_GetList(array("SORT" => "ASC", "ID" => "DESC", "CACHE" => array("TAG" => CCache::GetIBlockCacheTag(CCache::$arIBlocks[SITE_ID]["aspro_allcorp_content"]["aspro_allcorp_our-offers"][0]), "MULTI" => "Y")), array("IBLOCK_ID" => CCache::$arIBlocks[SITE_ID]["aspro_allcorp_content"]["aspro_allcorp_our-offers"][0], "ACTIVE" => "Y", "SECTION_GLOBAL_ACTIVE" => "Y", "ACTIVE_DATE" => "Y", "INCLUDE_SUBSECTIONS" => "Y"));
$arItemsBySectionID = CCache::GroupArrayBy($arItems, array("MULTI" => "Y", "GROUP" => array("IBLOCK_SECTION_ID")));

if($arSections){
  aspro::getSectionChilds(false, $arSections, $arSectionsByParentSectionID, $arItemsBySectionID, $aMenuLinksExt);
}
else{
  foreach($arItems as $arItem){
    $aMenuLinksExt[] = array($arItem["NAME"], $arItem["DETAIL_PAGE_URL"], array(), array("FROM_IBLOCK" => 1, "DEPTH_LEVEL" => 1));
  }
}

if($aMenuLinksExt){
  $aMenuLinks = array_merge($aMenuLinks, $aMenuLinksExt);
}
?>

596081fa266743ca919cae233df58cb4.JPG
the entire menu is made from an information block, but this menu item should have a link to another part of the site.
Thank you in advance for your help!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rad1calDreamer, 2016-03-03
@Theory

  1. in template
    UPD.
    if($aMenuLinksExt){
      $aMenuLinks = array_merge($aMenuLinks, $aMenuLinksExt);
    }

    change the logic here. replace array_merge with more complex processing and insert your link not at the end, but where you need

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question