我是Yii的新手。請幫我解決這個問題。我從我的數據庫中提取了一個數據。我必須在我看來顯示這些值。我可以在視圖中獲取數據。但細節視圖顯示「NOT SET」。我在這裏附上了我的觀點。提前致謝。顯示在視圖中提取的值
我的控制器動作:
public function actionView($id)
{
$host_id=$id;
$model=new NimsoftHostsDetails;
$detail = NimsoftHostsDetails::model()->findAllByAttributes(array('host_id'=>$id));
$this->render('view',array(
'model'=>$model,'host_detail'=>$detail
));
}
筆者認爲:
<?php
/* @var $this NimsoftHostsDetailsController */
/* @var $model NimsoftHostsDetails */
$this->breadcrumbs=array(
'Nimsoft Hosts Details'=>array('index'),
$model->id,
);
$this->menu=array(
array('label'=>'List NimsoftHostsDetails', 'url'=>array('index')),
array('label'=>'Create NimsoftHostsDetails', 'url'=>array('create')),
array('label'=>'Update NimsoftHostsDetails', 'url'=>array('update', 'id'=>$model->id)),
array('label'=>'Delete NimsoftHostsDetails', 'url'=>'#', 'linkOptions'=>array('submit'=>array('delete','id'=>$model->id),'confirm'=>'Are you sure you want to delete this item?')),
array('label'=>'Manage NimsoftHostsDetails', 'url'=>array('admin')),
);
?>
<h1>View NimsoftHostsDetails </h1>
<?php print_r($host_detail);?>
<?php $this->widget('zii.widgets.CDetailView', array(
'data'=>$model,
'attributes'=>array(
'id',
'host_id',
'host_start_date',
'host_end_date',
),
)); ?>