Answer the question
In order to leave comments, you need to log in
How to add links to partners?
On the main page there is a withdrawal of partners, there are 5 pictures, how to make a link for each, that is, by clicking on the picture to transfer it to the partner’s website?
Partner withdrawal code
<div class="container-custom">
<div class="owl-carousel partners-carousel owl-theme">
<?
$IBLOCK_ID = 6;
$arSelect = array("ID", "IBLOCK_ID", "NAME", "DATE_ACTIVE_FROM", "PROPERTY_*", "PREVIEW_PICTURE");
$arFilter = array("IBLOCK_ID" => $IBLOCK_ID, "ACTIVE_DATE" => "Y", "ACTIVE" => "Y");
$res = CIBlockElement::GetList(array('SORT' => 'ASC'), $arFilter, false, false, $arSelect);
while ($ob = $res->GetNextElement()) {
$arFields = $ob->GetFields();
$arProps = $ob->GetProperties();
$img = CFile::GetPath($arFields['PREVIEW_PICTURE']);
?>
<div class="carousel__item">
<img class="carosel__img" src="<?= $img ?>" alt="">
</div>
<?
}
?>
</div>
</div>
Answer the question
In order to leave comments, you need to log in
Catch the solution:
<?
$IBLOCK_ID = 6;
$arSelect = array("ID", "IBLOCK_ID", "NAME", "url", "DATE_ACTIVE_FROM", "PROPERTY_*", "PREVIEW_PICTURE");
$arFilter = array("IBLOCK_ID" => $IBLOCK_ID, "ACTIVE_DATE" => "Y", "ACTIVE" => "Y");
$res = CIBlockElement::GetList(array('SORT' => 'ASC'), $arFilter, false, false, $arSelect);
while ($ob = $res->GetNextElement()) {
$arFields = $ob->GetFields();
$arProps = $ob->GetProperties();
$img = CFile::GetPath($arFields['PREVIEW_PICTURE']);
$arPrp = array_column($arProps, null, 'NAME');
?>
<div class="carousel__item">
<a href="<? echo $arPrp["url"]['VALUE']; ?>">
<img class="carosel__img" src="<?= $img ?>" alt="">
</a>
</div>
<?
}
?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question