Pergunta

I have installed in Yii 1.1

 $this->widget('zii.widgets.CListView', array(
'template' => Yii::t('Site','Header News')

But how 'to do it in Yii2 ?

echo ListView::widget(['template' => Yii::t('Site','Header News'), 
    'dataProvider' => $tipsList,
    'itemView' => '_listItem',
    'layout' => '{items}{pager}',
    'itemOptions' => [
    ],
    'options' => [
        'links' => '<h2>test</h2>',
        'tag' => 'ul',
        'class' => 'ten-vertical summary-list',

    ],

    'viewParams' => array(
        'categoryAlias' => $categories[0]->urlAlias,
        'imageConfig' => array('width' => 120, 'height' => 120, 'fill' => true),
        'firstImageConfig' => array('width' => 436, 'height' => 436, 'fill' => true),
    ),
]);

Param 'template' => Yii::t('Site','Header News') does not work

Foi útil?

Solução

template property of ListView in Yii2 called layout. Link

Outras dicas

Example:

'layout' => '<li class="list-header">Header</li>{items}{pager}',
'options' => [
        'tag' => 'ul',
],

The li.list-header will be added into a parent tag ul

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top