|
|
|
Yii Framework ขึ้น Error แบบนี้แก้ไงครับ????????????????????? |
|
|
|
|
|
|
|
CListView ขึ้น Error แบบนี้อ่ะครับ
ส่วนของ Controller CListView ครับ
Chapter5Controller
<?php
class Chapter5Controller extends Controller{
function actionCGridView(){
$model = new Book();
$books = new CActiveDataProvider($model);
$this->render("CGridView" , array(
"books" => $books
));
}
function actionCListView(){
$model = new Book();
$books = new CActiveDataProvider($model);
$this->render("CListView" , array(
"books" => $books
));
}
}
?>
ส่วนของ Models CListView ครับ
ฺBook
<?php
class Book extends CActiveRecord{
public static function model($className = __CLASS__) {
return parent::model($className);
}
public function tableName() {
return "books";
}
public function attributeLabels() {
return array(
"id" => "รหัส" ,
"name" => "ชื่อหนังสือ" ,
"price" => "ราคา"
);
}
}
?>
ส่วนของ View CListView ครับ
CListView
<?php
$this->widget('zii.widgets.CListView' , array(
'dataProvider' => $books ,
'itemview' => '_CListView'
));
?>
_CListView
<div>
<div>
<span><?php echo $data->id; ?></span>
<span>หนังสือ = <?php echo $data->name; ?></span>
</div>
<div>
<span>ราคา = <?php echo $data->price; ?></span>
</div>
</div>
<hr>
ส่วน CGridView Run ได้ปกติครับ
ส่วนของ Controller CGridView ครับ
Chapter5Controller
<?php
class Chapter5Controller extends Controller{
function actionCGridView(){
$model = new Book();
$books = new CActiveDataProvider($model);
$this->render("CGridView" , array(
"books" => $books
));
}
function actionCListView(){
$model = new Book();
$books = new CActiveDataProvider($model);
$this->render("CListView" , array(
"books" => $books
));
}
}
?>
ส่วนของ Models CGridView ครับ
ฺBook
<?php
class Book extends CActiveRecord{
public static function model($className = __CLASS__) {
return parent::model($className);
}
public function tableName() {
return "books";
}
public function attributeLabels() {
return array(
"id" => "รหัส" ,
"name" => "ชื่อหนังสือ" ,
"price" => "ราคา"
);
}
}
?>
ส่วนของ View CGridView ครับ
CGridView
<?php
$this->widget('zii.widgets.grid.CGridView' , array(
'dataProvider' => $books ,
'columns' => array(
'id' ,
'name' ,
'price'
)
));
?>
Help Me Please!!!
Tag : PHP, CakePHP, Web Hosting, Web Hosting
|
ประวัติการแก้ไข 2015-06-04 16:23:09 2015-06-04 16:23:39 2015-06-04 16:26:05 2015-06-04 16:27:40 2015-06-05 10:14:05
|
|
|
|
|
Date :
2015-06-04 16:12:43 |
By :
nestzamaster |
View :
854 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
<?php
$this->widget('zii.widgets.CListView' , array(
'dataProvider' => $books ,
'itemView' => '_CListView' // itemView ตัว V ใหญ่
));
?>
|
|
|
|
|
Date :
2020-06-04 12:38:04 |
By :
PhrayaDev |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 01
|