1
Шаблоны PHP / Как в UMI на php вывести список из 3 новостей на главной?
« : 22 Февраля 2023, 18:41:36 »
Есть такой код, смотрел по инструкции но он не работает почему-то!
Код: [Выделить]
<?php $newsList = $this->macros('news', 'lastlist', array('news1', 10, 0, true));
foreach ($newsList['void:lines'] as $newsItem) : ?>
<?php $news = $this->getPageById($newsItem['attribute:id']); ?>
<a href="<?= $newsItem['attribute:link'] ?>">
<div class="news_item">
<div class="news_img_wr">
<?php $mainPhoto = $news->getValue('anons_pic'); ?>
<?php if ($mainPhoto instanceof iUmiImageFile) : ?>
<img src="<?= $mainPhoto ?>" />
<?php endif; ?>
<div class="news_data_block">
<?= date('d.m.Y', $newsItem['attribute:publish_time']) ?>
</div>
</div>
</a>
<div class="news_title_wr">
<a href="<?= $newsItem['attribute:link'] ?>">
<?= $news->getValue('h1') ?>
</a>
</div>
</div>
<?php endforeach; ?>