How to make alternating output?

base1::find()->all();
base2::find()=>all();

And here is the html view

base1->title
base2->title

How to setup the loop ?
August 19th 19 at 22:42
1 answer
August 19th 19 at 22:44
for example:
$arr = [];
$arr[] = MyModelOne::find()->limit(20)->asArray()->all();
$arr[] = MyModelSecond::find()->limit(20)->asArray()->all();
for($i = 0; $i < 20; $i++){
 if(isset($arr[0][$i]['title']) and isset($arr[1][$i]['title'])){
 echo $arr[0][$i]['title'];
 echo $arr[1][$i]['title'];
}else{
break;
}
}

it may be easier, but clearer. If you need to periodically do a Eris, it is better to make the logic in MyDataProvider

Find more questions by tags Yii