Question

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

Was it helpful?

Solution

template property of ListView in Yii2 called layout. Link

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top