V
V
Vadim Timoshenko2020-06-11 20:36:33
1C-Bitrix
Vadim Timoshenko, 2020-06-11 20:36:33

Why doesn't the component get an element ID?

I have the following component code:

$APPLICATION->IncludeComponent(
  "bitrix:news.detail", 
  "client", 
  array(
    "ACTIVE_DATE_FORMAT" => "d.m.Y",
    "ADD_ELEMENT_CHAIN" => "N",
    "ADD_SECTIONS_CHAIN" => "Y",
    "AJAX_MODE" => "N",
    "AJAX_OPTION_ADDITIONAL" => "",
    "AJAX_OPTION_HISTORY" => "N",
    "AJAX_OPTION_JUMP" => "N",
    "AJAX_OPTION_STYLE" => "Y",
    "BROWSER_TITLE" => "-",
    "CACHE_GROUPS" => "Y",
    "CACHE_TIME" => "86400",
    "CACHE_TYPE" => "A",
    "CHECK_DATES" => "N",
    "DETAIL_URL" => "",
    "DISPLAY_BOTTOM_PAGER" => "N",
    "DISPLAY_DATE" => "Y",
    "DISPLAY_NAME" => "Y",
    "DISPLAY_PICTURE" => "Y",
    "DISPLAY_PREVIEW_TEXT" => "Y",
    "DISPLAY_TOP_PAGER" => "N",
    "ELEMENT_CODE" => $_REQUEST["ELEMENT_CODE"],
    "ELEMENT_ID" => $_REQUEST["ELEMENT_ID"],
    "FIELD_CODE" => array(
      0 => "DATE_ACTIVE_TO",
      1 => "SHOW_COUNTER",
      2 => "",
    ),
    "IBLOCK_ID" => "13",
    "IBLOCK_TYPE" => "clients",
    "IBLOCK_URL" => "",
    "INCLUDE_IBLOCK_INTO_CHAIN" => "Y",
    "MESSAGE_404" => "",
    "META_DESCRIPTION" => "-",
    "META_KEYWORDS" => "-",
    "PAGER_BASE_LINK_ENABLE" => "N",
    "PAGER_SHOW_ALL" => "N",
    "PAGER_TEMPLATE" => ".default",
    "PAGER_TITLE" => "Страница",
    "PROPERTY_CODE" => array(
      0 => "",
      1 => "DEV",
      2 => "",
    ),
    "SET_BROWSER_TITLE" => "Y",
    "SET_CANONICAL_URL" => "N",
    "SET_LAST_MODIFIED" => "N",
    "SET_META_DESCRIPTION" => "Y",
    "SET_META_KEYWORDS" => "Y",
    "SET_STATUS_404" => "Y",
    "SET_TITLE" => "Y",
    "SHOW_404" => "N",
    "STRICT_SECTION_CHECK" => "N",
    "USE_PERMISSIONS" => "N",
    "USE_SHARE" => "N",
    "COMPONENT_TEMPLATE" => "client",
    "FILE_404" => ""
  ),
  false
);


This code prints "Element not found". If I change $_REQUEST["ELEMENT_ID"]to the real element ID, then everything works. $_REQUEST - does not contain an ELEMENT_ID.

My urlrewrite.php (in principle, it works, as it throws it where it needs to):

array (
    'CONDITION' => '#^/client/.*#',
    'RULE' => 'ELEMENT_ID=$1',
    'ID' => '',
    'PATH' => '/company/clients/detail.php',
    'SORT' => 100,
  ),


Infoblock settings in terms of addresses are as follows:
5ee269eb5c276722438658.png

Information block page URL: #SITE_DIR#/company/clients/
Detailed view page URL: #SITE_DIR#/client/#ELEMENT_CODE#/

Perhaps SEF_MODE should be used? But then how does the other section work, where did I copy the component code from?
Maybe I missed something here?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vadim Timoshenko, 2020-06-11
@PbI6A_KuT

As a result, I had to resort to a crutch using substr:

$url = $_SERVER['REQUEST_URI'];
$element_code = substr($url, 8, -1);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question