yii2-test-1/frontend/views/news/index.php

21 lines
441 B
PHP
Raw Permalink Normal View History

2023-05-06 20:40:02 +03:00
<?php
use common\models\News;
use yii\helpers\Url;
/** @var yii\web\View $this */
/** @var News $news */
?>
<h1>Новости</h1>
<?php if (!empty($news)):
foreach ($news as $new):
?>
<div>
<a href="<?= Url::base() . '/new/' . $new->slug ?>"><?= $new->title ?></a>
<p><?= $new->text ?></p>
</div>
<?php endforeach; else: ?>
<h2>Новостей нет</h2>
<?php endif; ?>