You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.1 KiB

7 years ago
<?php
3 years ago
use core\entities\post\Post;
7 years ago
use yii\helpers\Html;
use yii\helpers\StringHelper;
use yii\helpers\Url;
3 years ago
/**
* @var $posts Post[]
*/
7 years ago
?>
<div class="row">
<?php foreach ($posts as $post): ?>
<?php $url = Url::to(['/blog/post/post', 'id' =>$post->id]); ?>
<div class="product-layout col-lg-3 col-md-3 col-sm-6 col-xs-12">
<div class="product-thumb transition">
<?php if ($post->photo): ?>
<div class="image">
<a href="<?= Html::encode($url) ?>">
<img src="<?= Html::encode($post->getThumbFileUrl('photo', 'widget_list')) ?>" alt="" class="img-responsive" />
</a>
</div>
<?php endif; ?>
<div>
<div class="caption">
<h4><a href="<?= Html::encode($url) ?>"><?= Html::encode($post->title) ?></a></h4>
<p><?= Html::encode(StringHelper::truncateWords(strip_tags($post->description), 20)) ?></p>
</div>
</div>
</div>
</div>
<?php endforeach; ?>
</div>