내 테이블 작업에 저장된 데이터가 있습니다. 보기 섹션에서 표 형식으로 표시하려면 어떻게해야합니까? Yii 포럼을 방문했지만 작업을 수행 할 특정 옵션이 없습니다.
보기 작업에 대한 조치 :
public function actionViewJob() {
$criteria = "";
$model = new ViewJob();
/* What Should I do Here */
$this->render('viewjob', array(
'model' => $model
));
}
그리고 데이터베이스의 데이터를 나열하는 해당보기 :
/* What should I do Here. */
<h1>View Jobs</h1>
<div class="flash-success"></div>
<div class="form">
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="filtertable" style="float: left;">
<thead>
<tr>
<th width="11%" class="rowtop">No</th>
<th width="24%" class="rowtop">Title</th>
<th width="10%" class="rowtop">Description</th>
<th width="10%" class="rowtop">No_Vacancy</th>
<th width="10%" class="rowtop">Contact Email</th>
<th width="10%" class="rowtop">Edit</th>
<th width="10%" class="rowtop">Delete</th>
</tr>
</thead>
<tbody>
<?php // foreach ($posts as $post): ?>
<tr>
<td width="11%">
<?php ?>
</td>
<td width="24%">
<?php ?>
</td>
<td width="14%">
<?php ?>
</td>
<td width="14%">
<?php ?>
</td>
<td width="14%">
<?php ?>
</td>
</a>
</td>
</a>
</td>
</tr>
<?php //endforeach; ?>
</tbody>
</table>
<!-- form -->
당신의 행동에서 당신의 견해를 불러라.
public function actionViewJob() {
$model = new Job('search');
$params =array('model'=>$model,
);
$this->render('viewjob', $params);
}
데이터를 CActiveDataProvider 개체로 가져옵니다.
모델에서 검색 기능을 만듭니다.
public function search() {
$criteria=new CDbCriteria;
// TODO: Add other search criteria here
$criteria->compare('username','Tom',true);
return new CActiveDataProvider('Jobs', array(
'criteria'=>$criteria,
'sort'=>array(
'defaultOrder'=>'username ASC',
),
));
}
그런 다음 귀하의 관점에서
$this->widget('zii.widgets.grid.CGridView', array(
'dataProvider' => $model->search(),
'filter' => $model,
'columns' => array(
array(
'name' => 'title',
'type' => 'raw',
'value' => 'CHtml::encode($data->title)'
),
array(
'name' => 'description',
'type' => 'raw',
'value' => 'description',
),
),
));
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다