[英]Yii2 how to set the title for the widget ListView
我已經在Yii 1.1中安裝了
$this->widget('zii.widgets.CListView', array(
'template' => Yii::t('Site','Header News')
但是,如何在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),
),
]);
參數'template' => Yii::t('Site','Header News')
不起作用
Yii2中ListView的template
屬性稱為layout
。 鏈接
例:
'layout' => '<li class="list-header">Header</li>{items}{pager}',
'options' => [
'tag' => 'ul',
],
li.list-header將添加到父標簽ul中
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.