B
B
Big_person2015-12-14 18:51:15
PHP
Big_person, 2015-12-14 18:51:15

How to get element code in 1c-bitrix of the page on which the user is located in the template of another component?

The comments component is displayed on the product page in the catalog. The component in the template has the channel parameter, which must correspond to the element code of the catalog element that the user has opened.
How to get this value? Of course, you can take it directly to get the url of the page and get the desired string from it through a regular expression, but this is a crutch.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey, 2015-12-14
@Logic87

In element.php insert a call to your comment component and set channel to $ElementID

N
no_one_safe, 2015-12-14
@no_one_safe

If you are using a non-complex component, then in the template folder we create component_epilog.php with something like this:
And where needed

$ELEMENT_ID = $APPLICATION->GetPageProperty('ELEMENT_ID');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question