G
G
Good Samaritan2017-11-02 15:07:15
1C-Bitrix
Good Samaritan, 2017-11-02 15:07:15

I don't understand how to make cnc?

I have section elements in catalog.section.list

foreach($arResult['SECTIONS'][$key]["ELEMENTS"] as $key2=>$value){
                         ?><li>
                             <a href="detail.php?ELEMENT_ID=<?=$value["ID"]?>">
                                 <?=$value["NAME"];?>
                             </a>
                         <li><?
                     }

as a result, in the browser you get a link like /careers/vacancies/detail.php?ELEMENT_ID=12
How do I make a link like /careers/vacancies/12 out of it?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Alexey Emelyanov, 2017-11-02
@babarun

https://dev.1c-bitrix.ru/learning/course/?COURSE_I...
https://dev.1c-bitrix.ru/learning/course/index.php...
https://dev.1c -bitrix.ru/api_help/main/general/url...

S
Sergey, 2017-11-02
@gangstarcj

In the same place SECTION_PAGE_URL should be in an array with a full link

Z
zhdoon, 2017-11-03
@zhdoon

<?php foreach($arResult['SECTIONS'][$key]["ELEMENTS"] as $key2=>$value){
?><li>
     <a href="/careers/vacancies/<?=$value["ID"]?>">
          <?=$value["NAME"];?>
     </a>
     <li><?php
}?>

A
Alexander Filippenko, 2017-11-05
@alexfilus

Check the CNC settings of the infoblock and the catalog component that will display these sections.
Also, you are doing something weird. Why with catalog.section.list a list of elements? If this menu should be with sections and products, then I can throw off the component for forming the menu.
Or show at least how you get the list of elements. If 'DETAIL_PAGE_URL' is passed to $arSelect and the traversal is done with GetNext rather than Fetch, then you should already have the correct link in the array, formed according to the infoblock CNC settings.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question