Answer the question
In order to leave comments, you need to log in
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
);
$_REQUEST["ELEMENT_ID"]
to the real element ID, then everything works. $_REQUEST - does not contain an ELEMENT_ID. array (
'CONDITION' => '#^/client/.*#',
'RULE' => 'ELEMENT_ID=$1',
'ID' => '',
'PATH' => '/company/clients/detail.php',
'SORT' => 100,
),
Answer the question
In order to leave comments, you need to log in
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 questionAsk a Question
731 491 924 answers to any question