Change the default View of the Yii ListView widget

We can configure the ListView widget to render our own custom View from a php file.

<?php 
echo \Yii\widgets\ListView::widget([
     'dataProvider'=>$dataProvider,
     'itemView'=>'_my_custom_view', // this is where you have to specify the view file

     'layout'=>'<div class="d-flex">{items}</div>{pager}', // here you can specify how the listview should render your custom view file. {items} is the list items and {pager} is the pagination component

     'itemOptions'=>[
       'tag'=>false, // we don't want the wrapping div for each item
     ], 
     // itemOptions is the place where we can add Html attribute for the wrapper element
])

Documentation Link.

Running low on budget? Get the best Shared hosting at an Affordable Rate!