I am developing my web application in the Yii framework . I do not have enough experience in the Yii framework. I want to make the view for the index post page. The Yii provide the CListView for this, but I want to make some customization on that.
You can extend a widget with the following steps:
Copy CListView.php from /(yii root)/framework/zii/widgets to /(application root)/protected/widgets
Rename the file BineshListView.php
Open BineshListView.php. Add this before the class declaration
Yii::import("zii.widgets.CListView");
Change the first line of the class declaration to:
class BineshListView extends CListView { ...
Now, you have your own BineshListView class you can customize. To use it in a view, you can call it like you would CListView
$this->widget('application.widgets.BineshListView', array( 'data'=>$model, etc... ) );
Let me add that BineshListView will inherit all the properties and methods of CListView. Therefore, if you do not need to customize a property or method and want to use the original behavior of CListView, you can delete the property or method from BineshListView.
you no need to customize the ClistView . just simply make changes in the partial view file . which is called by the ClistView.
<?php
$this->widget('zii.widgets.ClistView',arrray(
'dataprovider'=>$your-data-provider,
'view-file'=>'custom-view-file'
));
?>
make changes in custom-view-file. make sure the custom-view-file in same views folder for the controller.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With