Stackoverflow
How do I get the itemView count. I want to do something on every third item in the ListView.
echo ListView::widget([
'dataProvider' => $modelDataProvider,
'itemView' => '_item_view',
'viewParams' => [
'count' => $itemcount // How to get this variable?
],
])
// _item_view.php
if($count % 3 == 0) {
// this item is the third in a row, do something special
}
Any help is appreciated!
Aucun commentaire:
Enregistrer un commentaire