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]
Framework
-
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]…
-
Basicly, Yii basic skeleton already come with aunthentication system which is very simple by checking username and password both admin or demo. The default authentication files is UserIdentity.php LoginForm.php SiteController.php Login.php
-
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…