How to display latest news with different size images?

Good day people, I have a question?
Judging from the title you can already understand
I was on the main store 5 records, one of the entries is a big picture, description and a couple of buns. With her 4 the rest of the record.
I do code such a game
$ext = extrime::find()->select('id, title, excerpt, mini_img, id_category, id_user')->limit(5)->all();
$ext_one = extrime::find()->select('id, title, excerpt, mini_img mid_category, id_user')->limit(1)->all();

Tobish for each block vyzval a separate post. But then the post that the title is replicated in small blocks...
Here's a picture 59d3ae884e01c161623767.png
Here is the code
59d3aed79ee7c576224352.png
How to do everything in one cycle, not to split into two variables which provide information... p.s(practiced with yii)
June 14th 19 at 20:28
2 answers
June 14th 19 at 20:30
Solution
Why is it so crazy to do.
In the request, do so:
$ext = extrime::find()->orderBy(['dtae' => SORT_DESC])->all();

Then the provider:
$provider = new ActiveDataProvider([
 'query' => $ext,
 'pagination' => [
 'pageSize' => 10,
],
 ]);

In the view:
<?= \yii\widgets\ListView::widget([
 'dataProvider' =--> $provider,
 'id' => 'restaurants-news',
 'itemOptions' => ['class' => 'col-12 restaurants-news__item'],
 'itemView' => 'partials/_view',
 ]); ?>

In the view of ListView:
<?php if ($index === 1): ?>
// here is the layout for the first entry
<?php else: ?>
// here for the rest
<?php endif; ?>
Thank you - Ottis_Kautzer commented on June 14th 19 at 20:33
June 14th 19 at 20:32
1) class names decided to write with a capital letter. extrime -> Extrime
2) When query ->all() without specifying the index, you get an array like this
$models = [
0=>'Model1',
1=>'Model2'
]

What does it mean if in the array that is the first element you can access via $ext[0] .
I know about that, but that's not what I need... - Ottis_Kautzer commented on June 14th 19 at 20:35
then describe the problem in more detail, because right now it looks like to get the first element of the array, and perhaps in some other parts of the site too. - Ottis_Kautzer commented on June 14th 19 at 20:38
Clear - cali.Senger99 commented on June 14th 19 at 20:41

Find more questions by tags YiiPHP