Category Archives: Yii Framework

Yii Hint For Files Handling

This post will help you to learn “how to delete files in yii framework”. I deleted singele file and all files from directory. Delete All Files Inside Directory php glob() method used to read all files from directory of yii application and unlink() method used to delete the files. //your directory $dir=Yii::app()->basePath.’/files/foldername/’; foreach(glob($dir.’*.*’) as $files){ […]

Date Picker In Yii

Date Picker In Yii. I added this articles for yii framework datepicker. It will help you to understand yii datepicker concept. It contains the inline datepicker, multiple months datepicker, date range, date format etc DownloadDemo Yii CJuiDatePicker: Default Yii CJuiDatePicker: Inline Yii CJuiDatePicker: Show/Select Other Month Dates Yii CJuiDatePicker: Display Button Bar(showButtonPanel) Yii CJuiDatePicker: Display […]

How To Handle CGridview in Yii

CGridview Basic  CGridview With User Methods CGridview Css Style CGridview CButtonColumn CGridview Ajax CGridview enableSorting Images In CGridview Link In CGridview CGridview Summary Text Pagination Header Text And Override Pagination CSS Empty Result Text CGridview After Delete Support Files CGridview Pagination Text Column Header In CGridview Row Selection Or Click Event In CGridView Add Css […]

How To Handle CJuiTabs in Yii

I created this yii cjuitabs article from my experience.When you read this article you can understand the yii cuitabs to handle differenct way.When i work on project, I need to assign the color for each tabs. I did this using span. Download Yii CJuiTabsDemo Yii CJuiTabs Static CJuiTabs Render CJuiTabs Dynamic CJuiTabs CJuiTabs With Class(Style) […]

Yii Accordion

Download Yii AccordionDemo Yii Accordion I added code here for “Yii Accordion” from my experience. The topics are Yii Default Accordion Yii Accordion Auto Height True/False Yii Accordion Icon Dynamic Yii Accordion Menu With Color Yii Default Accordion This is the default jquery accordion using yii. &l;t?php $this->widget(‘zii.widgets.jui.CJuiAccordion’,array( ‘panels’=>array( ‘panel 1’=>’content for panel 1’, ‘panel […]

FindAll In Yii

Yii Framework. I list out all types of find, findall conditions in yii framework. It will very helpful for us. Yii find() find() <?php $model = User::model()->find(); find() With Condition <?php $model = User::model()->find(‘userid=1 AND status=”A”‘); (OR) $model = User::model()->find(‘userid=:userId And status=:Status’, array(‘:userId’=>1,’:status’=>’A’)); find() Width Criteria <?php $criteria = new CDbCriteria; $criteria->condition=’userid=1 AND status=”A”‘; $model […]

Image Upload With Dimension Validation In Yii Model

This tutorial will help you to upload the image with image extension validation, image size validation and image dimension validation. So we can fix the width and height for image. CFileValidator is used to validate the file or image types, image maximum size, image minimum size etc. To validate the dimension, we dont have option […]

Username Validation In Yii Model

From my sourcecode, I gave the information for username validation in yii framework. <?php class User extends CActiveRecord { public static function model($className=__CLASS__) { return parent::model($className); } public function tableName() { return ‘tbl_user’; } public function rules() { array(‘username’, ‘match’, ‘pattern’ => ‘/^[A-Za-z0-9_]+$/u’, ‘message’=>’Username can contain only alphanumeric characters and hyphens(-).’), array(‘username’,’unique’), } } ?>

Yii 1.0 Model Structure

By default model classes are available within the protected/models dirctory. Every class must be inherit from the CModel or subclass. Yii difines two sub classes. They are CActiveRecord, CFormModel. CActiveRecord is conntected with database table model (classes) and it represent the table structure. CFormModel is the basic model class and conntected to HTML forms. Class Extend CFormModel Structure Class Extend CActiveRecord […]