Created
May 8, 2025 12:30
-
-
Save eagles038/ac25bb898afe6bd143fd7c8d15c519b7 to your computer and use it in GitHub Desktop.
Элементы из нескольких инфоблоков
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <? | |
| $newsId = getElem(449)["PROP"]["PRESS_NEWS"]["VALUE"]; | |
| $pressIblocks = IBLOCK_POSTS; | |
| $arFilter = Array("IBLOCK_ID" => $pressIblocks, "ACTIVE" => "Y", "ID" => $newsId, "PROPERTY_".showPost() => "Y"); | |
| $res = CIBlockElement::GetList(Array("id" => $newsId), $arFilter, false, ["nPageSize" => 1], array()); | |
| $news = []; | |
| while($ob = $res->Fetch()) | |
| { | |
| $news[] = $ob; | |
| } | |
| $mainNews = $news; | |
| if (!empty($news)) { | |
| ?> | |
| <div class="news mobile-swiper swiper"> | |
| <div class="swiper-wrapper news-swiper-wrapper"> | |
| <? $anim = 0.7; ?> | |
| <?foreach($news as $key => $arItem):?> | |
| <? | |
| $dateActive = str_replace('.', ' / ', $arItem["DATE_ACTIVE_FROM"]); | |
| $detailUrl = str_replace('#SITE_DIR#', '', $arItem["DETAIL_PAGE_URL"]); | |
| if ($arItem["IBLOCK_SECTION_ID"]) { | |
| $res = CIBlockSection::GetByID($arItem["IBLOCK_SECTION_ID"]); | |
| if($ar_res = $res->GetNext()) { | |
| $detailUrl = str_replace('#SECTION_CODE#', $ar_res["CODE"], $detailUrl); | |
| } | |
| } | |
| $detailUrl = str_replace('#ELEMENT_CODE#', $arItem["CODE"], $detailUrl); | |
| ?> | |
| <div class="swiper-slide news-card news-card-large wow fadeInUp" data-wow-duration="1.5s" data-wow-delay="0.5s"> | |
| <a href="<?= $detailUrl; ?>" class="news-card-image"> | |
| <? if ($arItem['PREVIEW_PICTURE']) { ?> | |
| <img src="<?= CFile::GetPath($arItem['PREVIEW_PICTURE']); ?>" alt="<?= $arItem["NAME"]; ?>"> | |
| <? } else { ?> | |
| <img src="<?= SITE_TEMPLATE_PATH ?>/assets/img/no_photo.png" alt="<?= $arElement["NAME"]; ?>" loading="lazy"> | |
| <? } ?> | |
| <? if ($arItem["DATE_ACTIVE_FROM"]) { ?> | |
| <span class="news-card-date"><?= $dateActive; ?></span> | |
| <? } ?> | |
| </a> | |
| <div class="tags tags-column tags-column-end tags-micro goods-card-tags"> | |
| <span class="tag tag-theme">Главная новость</span> | |
| </div> | |
| <div class="news-card-text"> | |
| <h3><a href="<?= $detailUrl; ?>"><?= $arItem["NAME"]; ?></a></h3> | |
| <?= $arItem['PREVIEW_TEXT']; ?> | |
| </div> | |
| </div> | |
| <?endforeach;?> | |
| </div> | |
| <div class="swiper-scrollbar news-swiper-scrollbar"></div> | |
| </div> | |
| <? } } ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment