将Yii2中的渲染命令转换为smarty

By simon at 2018-02-28 • 0人收藏 • 49人看过

如何在。tpl *文件中更改此代码? * 1)

$ this-> render ('_form', [
     'model' => $ model,
 ]);
* 2)*
GridView :: widget ([
     'dataProvider' => $ dataProvider,
     'filterModel' => $ searchModel,
     'columns' => [
         ['class' => 'yii \ grid \ SerialColumn'],

         'id',
         'title'

         ['class' => 'yii \ grid \ actioncolumn'],
     ],
 ]);
我把2号改为:
{GridView 'dataProvider'=$dataProvider,'filterModel'=$searchModel,columns=[  
        ['class' => 'yii\grid\SerialColumn'],
        'id',
        'title',
        ['class' => 'yii\grid\ActionColumn'],    ]
 } 
但是这个错误发生! :“太多速记属性”

2 个回复 | 最后更新于 2018-02-28
2018-02-28   #1

对于Gridview

{GridView::widget([
          'dataProvider' => $dataProvider,
          'filterModel' => $searchModel,
          'columns' => [ 
               ['class' => 'yii\grid\SerialColumn'],
               ['attribute' => 'id'],
               ['attribute' => 'title'],
               ['class' => 'yii\grid\ActionColumn']
          ]
])}
其中id和title是$ dataProvider的字段并记得在顶部使用 的页面
{use class="yii\grid\GridView"}
呈现tpl使用:
{$this->render('_form.tpl', ['model' => $Model])}

2018-02-28   #2

对于Gridview

{GridView::widget([
          'dataProvider' => $dataProvider,
          'filterModel' => $searchModel,
          'columns' => [ 
               ['class' => 'yii\grid\SerialColumn'],
               ['attribute' => 'id'],
               ['attribute' => 'title'],
               ['class' => 'yii\grid\ActionColumn']
          ]
])}
其中id和title是$ dataProvider的字段并记得在顶部使用 的页面
{use class="yii\grid\GridView"}
呈现tpl使用:
{$this->render('_form.tpl', ['model' => $Model])}

登录后方可回帖

Loading...