php - how go to next page in yii2 from listview? -
i having problem on yii2 please how move 1 page in listview that's nothing try seems working. want when listview clicked takes page , carries datas of colon click. next page
this index.php
<?php use yii\widgets\listview; use yii\data\arraydataprovider; use app\models\myprofile; use app\models\likediscussion; use yii\widgets\activeform; use common\models\topic; use yii\widgets\pjax; use yii\helpers\html; use frontend\assets\appasset; $this->title = 'my yii application'; ?> <?php $query = topic::find()->all(); $dataarr = array(); foreach ($query $detail) { $dataarr[] = array( 'topic_id' => $detail->topic_id, 'topic' => $detail->topic, 'created' => $detail->created, 'creator' => $detail->creator, 'views' => $detail->views ); } $dataprovider = new arraydataprovider([ 'allmodels' => $dataarr, 'pagination' => [ 'pagesize' => 10, ], 'sort' => [ 'attributes' => ['views'=>sort_asc] ], ]); ?> <?php pjax::begin(['id' => 'countries']) ?> <?= listview::widget([ 'dataprovider' => $dataprovider, 'itemoptions' => ['class' => 'comment-item'], 'itemview' => 'indexadapter', ]); ?> <?php pjax::end() ?> <div class="hr"> </div>
indexadapter
<?php use yii\helpers\html; use yii\helpers\htmlpurifier; //var_dump($model);exit; ?> <div class="gravatar" > <img src="images/gravatar.png" alt="" > </div> <h5><?php echo $model['topic_id']; ?> </h5> <p> <h5> <span class="commentdate"> <?php echo $model['created']. "by" .$model['creator']; ?> </span> </h5> </p> <hr>
try this
<?= html::a(html::encode($model->topic_id), ['view', 'id' => $model->id]); ?>