N
N
NakedFace2015-12-18 16:49:53
PHP
NakedFace, 2015-12-18 16:49:53

How to make a dropdown with news sections in the top menu and fix broken news links in Bitrix?

Hello!
212.47.240.137 - there is such a site.
As you can see, there is a News item in the top menu, when you hover over it, a list with sections of these news should drop out.
Now it's just a list of other infoblocks.
The drop-down menu is formed from the left menu, which is on the page 212.47.240.137/info (same news)
Tell me how to make a list of news sections in the dropdown?
And one more question:
it is not known after what the links to each news separately stopped working, although they are correct.
The news infoblock settings contain the following settings:
CNC directory (relative to the site root): /info/news/
Detailed view page: /#ELEMENT_CODE#/
The Section page field is empty.
Thanks in advance.
Here are the full settings for the news infoblock:

<?$APPLICATION->IncludeComponent(
  "bitrix:news",
  "news",
  Array(
    "ADD_ELEMENT_CHAIN" => "N",
    "ADD_SECTIONS_CHAIN" => "N",
    "AJAX_MODE" => "N",
    "AJAX_OPTION_ADDITIONAL" => "",
    "AJAX_OPTION_HISTORY" => "N",
    "AJAX_OPTION_JUMP" => "N",
    "AJAX_OPTION_STYLE" => "Y",
    "BROWSER_TITLE" => "-",
    "CACHE_FILTER" => "N",
    "CACHE_GROUPS" => "N",
    "CACHE_TIME" => "100000",
    "CACHE_TYPE" => "A",
    "CHECK_DATES" => "Y",
    "COMPONENT_TEMPLATE" => "news",
    "DETAIL_ACTIVE_DATE_FORMAT" => "j F Y",
    "DETAIL_DISPLAY_BOTTOM_PAGER" => "Y",
    "DETAIL_DISPLAY_TOP_PAGER" => "N",
    "DETAIL_FIELD_CODE" => array("DETAIL_TEXT","DETAIL_PICTURE","DATE_ACTIVE_FROM",""),
    "DETAIL_PAGER_SHOW_ALL" => "Y",
    "DETAIL_PAGER_TEMPLATE" => "",
    "DETAIL_PAGER_TITLE" => "Страница",
    "DETAIL_PROPERTY_CODE" => array("FORM_QUESTION","FORM_ORDER","PHOTOPOS","LINK_GOODS","VIDEO","PHOTOS","DOCUMENTS",""),
    "DETAIL_SET_CANONICAL_URL" => "N",
    "DISPLAY_BOTTOM_PAGER" => "Y",
    "DISPLAY_NAME" => "N",
    "DISPLAY_TOP_PAGER" => "N",
    "HIDE_LINK_WHEN_NO_DETAIL" => "Y",
    "IBLOCK_ID" => "18",
    "IBLOCK_TYPE" => "aspro_allcorp_content",
    "IMAGE_POSITION" => "left",
    "INCLUDE_IBLOCK_INTO_CHAIN" => "N",
    "LIST_ACTIVE_DATE_FORMAT" => "j F Y",
    "LIST_FIELD_CODE" => array("NAME","PREVIEW_TEXT","PREVIEW_PICTURE","DATE_ACTIVE_FROM",""),
    "LIST_PROPERTY_CODE" => array("",""),
    "MESSAGE_404" => "",
    "META_DESCRIPTION" => "-",
    "META_KEYWORDS" => "-",
    "NEWS_COUNT" => "20",
    "PAGER_BASE_LINK_ENABLE" => "N",
    "PAGER_DESC_NUMBERING" => "N",
    "PAGER_DESC_NUMBERING_CACHE_TIME" => "36000",
    "PAGER_SHOW_ALL" => "N",
    "PAGER_SHOW_ALWAYS" => "N",
    "PAGER_TEMPLATE" => ".default",
    "PAGER_TITLE" => "Новости",
    "PREVIEW_TRUNCATE_LEN" => "",
    "SEF_FOLDER" => "/info/news/",
    "SEF_MODE" => "Y",
    "SEF_URL_TEMPLATES" => Array("detail"=>"/#ELEMENT_CODE#/","news"=>"","section"=>""),
    "SET_LAST_MODIFIED" => "N",
    "SET_STATUS_404" => "N",
    "SET_TITLE" => "Y",
    "SHOW_404" => "N",
    "SORT_BY1" => "ACTIVE_FROM",
    "SORT_BY2" => "SORT",
    "SORT_ORDER1" => "DESC",
    "SORT_ORDER2" => "ASC",
    "USE_CATEGORIES" => "N",
    "USE_FILTER" => "N",
    "USE_PERMISSIONS" => "N",
    "USE_RATING" => "N",
    "USE_RSS" => "N",
    "USE_SEARCH" => "N",
    "USE_SHARE" => "Y"
  )
);?><br>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mechanic, 2015-12-20
@NakedFace

In order for the menu to have sections, the file of the left menu should have approximately

<?
if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();

global $APPLICATION;

$aMenuLinksExt=$APPLICATION->IncludeComponent("bitrix:menu.sections", "", array(
   "IS_SEF" => "N",
   "ID" => $_REQUEST["ID"],
   "IBLOCK_TYPE" => "tehnic",
   "IBLOCK_ID" => "4",
   "SECTION_URL" => "",
   "DEPTH_LEVEL" => "4",
   "CACHE_TYPE" => "A",
   "CACHE_TIME" => "3600"
   ),
   false
);

$aMenuLinks = array_merge($aMenuLinks, $aMenuLinksExt);
?>

those. into an array with links we subsume a component with IB sections. Naturally edit the code for yourself - IB id, etc.
As for the broken links - most likely this is due to the activated and not fully configured CNC. Try disabling CNC in component settings. If the links work, then so be it. Turn on the CNC again and check the CNC settings in the news IB itself for a match with the component settings.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question