php - Class 'CHtml' not found in Gridview in Yii2 -


i developing yii2 application want list orders data in gridview.

user can click on order id , redirected gridview order details listing. want display link order id redirect order details page.

but got following error:

class 'chtml' not found

in gridview. here code:

<?= gridview::widget([     'dataprovider' => $dataprovider,     'filtermodel' => $searchmodel,     'columns' => [          ['class' => 'yii\grid\serialcolumn'],          [              'attribute'  => 'id',              'value' => chtml::link("link", yii::app()->createurl("user/view")),              'format'  => 'raw',          ],          'user_id',          'amount',          'promo_code_used',             ['class' => 'yii\grid\actioncolumn'],     ], ]) ?> 

thers no chtml in yii2. use html helper instead (see docs here , here). generating hyperlink use html::a() instead of chtml::link(). code this:

use yii\helpers\html;      ...  echo html::a("link", ["user/view"]); 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -