Framework

  • Sample using CActiveDataProvider Sample 1: [php] $dataProvider=new CActiveDataProvider(‘User’,array( ‘criteria’=>array( ‘condition’=>’activationstatus = 1’), )); [/php] Sample 2: [php] $dataProvider=new CActiveDataProvider(‘Event’, array( ‘criteria’=>array( ‘condition’=>’date >= "’.date(‘Y-m-d’, strtotime(‘-2 years’)).’"’, ), )); [/php] Sample 3: [php] $dataProvider=new CActiveDataProvider(‘Post’, array( ‘pagination’=>array( ‘pageSize’=>5, ), ‘criteria’=>$criteria, )); [/php] Sample 4: [php] $dataProvider=new CActiveDataProvider(‘User’) [/php]

    Baca catatan

  • Some function is created to make code easy to read and manageable. The Lookup function is so powerfull to simplified data storage. Usually we store Approve, Not Approved, Qualified, Not Qualified in words for each records, but with Lookup class, we can make it short to an integer for each properties. Table scheme “tbl_lookup” [php]…

    Baca catatan

  • CGridView is one of Zii Components There is other than CGridView, CDetailView, CListView. Look here. CGridView use DataProvider which define in controller CGridView display data in tables. Supports paginating, sorting, searching. Also support view, update, delete method Define our data provider in controller like this [php] /** * Lists all models. */ public function actionIndex()…

    Baca catatan

  • In this tutorial we discuss about the basic principal of MVC using Yii Framework. How to create Model extends from CFormModel which we collect data from it, to create related Controller and finishing at View. 1. Generate webapp from Command Prompt yiic webapp myapps 2. Uncomment gii on myapps/protected/config/main.php. Set your prefered password. This allow us…

    Baca catatan