我正在尝试从数据库中获取信息,我是yii的新手,所以这对我有用,但是现在我应用了AdminLTE主题,并且我希望整个应用程序都适合该主题,而我在显示数据时遇到问题带有foreach循环。
我已经阅读了yii框架手册,但没有找到此信息,也找不到任何特定的信息。
我有这样的感觉:
<?php
$this->widget('zii.widgets.grid.CGridView', array(
'summaryText' => 'Mostrando {start}-{end} de {count} registro(s).',
'emptyText' => 'Não foram encontrados resultados',
'id' => 'user-grid',
// 'itemsCssClass' => 'table table-striped table-hover',
'dataProvider' => $model->search(),
'filter' => $model,
'columns' => array(
'id',
'username',
'password',
'email',
array(
'name' => 'tipo',
'value' => '$data->tipo0->tipo',
//filtra os tipos de stock
'filter' => CHtml::listData(TipoStock::model()->findAll(), 'id', 'tipo'),
),
array(
'class' => 'CButtonColumn',
),
),
));
?>
现在我要这样:
<div class="box box-primary">
<div class="box-body">
<table id="table" class="table table-bordered table-hover">
<thead>
<tr>
<th style="width: 20%;">ID</th>
<th style="width: 30%;">Username</th>
<th style="width: 10%;">Password</th>
<th style="width: 10%;">Email</th>
<th style="width: 10%;">Tipo</th>
<th style="width: 5%;"> </th>
</tr>
</thead>
<tbody>
<?php foreach ($model as $modelo) { ?>
<tr>
<td><?php echo $modelo->id ?></td>
<td><?php echo $modelo->username ?></td>
<td><?php echo $modelo->password ?></td>
<td><?php echo $modelo->email ?></td>
<td><?php echo $modelo->tipo ?></td>
</tr>
<?php }
?>
</tbody>
</table>
</div>
</div>