yii2 render page in smarty(.tpl file)

How to change this code in .tpl files?




$ this-> render ('_form', [

     'model' => $ model,

 ]);






GridView :: widget ([

                                         'dataProvider' => $ dataProvider,

                                         'filterModel' => $ searchModel,

                                         'columns' => [

                                                                ['class' => 'yii \ grid \ SerialColumn'],'id','title',['class' => 'yii \ grid \ actioncolumn'],

                                                          ],

 ]);



i changed number 2 to :




{GridView 'dataProvider'=$dataProvider,'filterModel'=$searchModel,columns=[  

                                                        ['class' => 'yii\grid\SerialColumn'],

                                                        'id',

                                                        'title',

                                                        ['class' => 'yii\grid\ActionColumn'],    ]

 } 



but this error Happened !! => "too many shorthand attributes"

For Gridview




{GridView::widget([

          'dataProvider' => $dataProvider,

          'filterModel' => $searchModel,

          'columns' => [ 

               ['class' => 'yii\grid\SerialColumn'],

               ['attribute' => 'id'],

               ['attribute' => 'title'],

               ['class' => 'yii\grid\ActionColumn']

          ]

])}



And use it in top of the page




{use class="yii\grid\GridView"}



To render a tpl use:




{$this->render('_form.tpl', ['model' => $Model])}



Please wrap your code with


[code] 

[/code]

so it´s better readable.

done! tank you for your comment.