template
property of ListView in Yii2 called layout
. Link
Yii2 how to set the title for the widget ListView
-
05-07-2023 - |
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
Solução
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