Answer the question
In order to leave comments, you need to log in
How to display voting in the right place of the detailed page in Bitrix?
Site on Bitrix, edition Start.
In the settings of the News component, I check the box Allow voting. Voting appears on the detailed one, but at the very bottom, because in detail.php "bitrix:iblock.vote" is located under "bitrix:news.detail".
I want to place a vote under the title of the posted news.
I tried to take the code from detail.php
<?$APPLICATION->IncludeComponent(
"bitrix:iblock.vote",
"stars",
Array(
"IBLOCK_TYPE" => $arParams["IBLOCK_TYPE"],
"IBLOCK_ID" => $arParams["IBLOCK_ID"],
"ELEMENT_ID" => $ElementID,
"MAX_VOTE" => $arParams["MAX_VOTE"],
"VOTE_NAMES" => $arParams["VOTE_NAMES"],
"CACHE_TYPE" => $arParams["CACHE_TYPE"],
"CACHE_TIME" => $arParams["CACHE_TIME"],
),
$component
);?>
Answer the question
In order to leave comments, you need to log in
As a result, they helped in technical support. The problem was that $ElementID is determined only at the moment of connecting bitrix:news.detail
<?$ElementID = $APPLICATION->IncludeComponent(
"bitrix:news.detail",
<?$APPLICATION->IncludeComponent(
"bitrix:iblock.vote",
"stars",
array(
"IBLOCK_TYPE" => $arParams['IBLOCK_TYPE'],
"IBLOCK_ID" => $arParams['IBLOCK_ID'],
"ELEMENT_ID" => $arResult['ID'],
"ELEMENT_CODE" => "",
"MAX_VOTE" => "5",
"VOTE_NAMES" => array("1", "2", "3", "4", "5"),
"SET_STATUS_404" => "N",
"DISPLAY_AS_RATING" => $arParams['VOTE_DISPLAY_AS_RATING'],
"CACHE_TYPE" => $arParams['CACHE_TYPE'],
"CACHE_TIME" => $arParams['CACHE_TIME']
),
$component,
array("HIDE_ICONS" => "Y")
);?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question