M
M
m4son2018-10-12 12:55:59
1C-Bitrix
m4son, 2018-10-12 12:55:59

How to change the link to a file in the included area in 1C-Bitrix?

There is a menu, an include area is inserted into the menu template.
In order for different items to display their own include area, I inserted the following code:
<? $cnt=0; ?>
<?
foreach($arResult as $arItem):
if($arParams["MAX_LEVEL"] == 1 && $arItem["DEPTH_LEVEL"] > 1)
continue;
?>
<li>
<a href="<?=$arItem["LINK"]?>"><?=$arItem["TEXT"]?></a>
<?if ($cnt==0) :?>
<?$APPLICATION->IncludeComponent(
"bitrix:main.include",
"",
Array(
"AREA_FILE_SHOW" => "file",
"PATH" => "link_1.php"
)
);?>
<?elseif ($cnt==1):?>
<?$APPLICATION->IncludeComponent(
"bitrix:main.include",
"",
Array(
" AREA_FILE_SHOW" => "file",
"AREA_FILE_SUFFIX" => "inc",
"EDIT_TEMPLATE" => "standard.php",
"PATH" => "link_2.php"
)
);?>
<?elseif ($cnt= =2):?>
<?$APPLICATION->IncludeComponent(
"bitrix:main.include",
"",
Array(
"AREA_FILE_SHOW" => "file",
"AREA_FILE_SUFFIX" => "inc",
"EDIT_TEMPLATE" => "standard.php",
"PATH" => "link_3.php"
)
);?>
<?endif?>
</li>
<? $ct++; ?>
<?endforeach?>
However, these are crutches. How to make the digit in the path to the file of the include area change when the elements are displayed ???

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Filippenko, 2018-10-12
@m4son

"PATH" => "link_".++$cnt.".php"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question