From my sourcecode, I gave the information for password validation in yii framework. I used password and confirm password validation.
Read More...
Showing posts with label Yii Framework. Show all posts
Showing posts with label Yii Framework. Show all posts
Tuesday, December 18, 2012
Email Validation In Yii Model
by Unknown
From my sourcecode, I gave the information for email validation in yii framework.
Read More...
Username Validation In Yii Model
by Unknown
From my sourcecode, I gave the information for username validation in yii framework.
Read More...
Wednesday, October 10, 2012
HTML TO PDF IN YII FRAMEWORK
by Unknown
Download the files using below link to generate html to PDF files. Download HTML2PDFNext: Extract it and you will get following folders and files Folder _class _tcpdf_5.0.002 locale Files html2pdf.class Next: Create Folder inside extension of yiiframework as "tcpdf". Copy above files and folders and paste into "tcpdf" folder. Next: html2pdf.class has contains "HTML2PDF" class. I changed html2pdf.class file name as "HTML2PDF" (For my use) Call this view from controller.Ex. In reportview.php Ex: In reportviewcontent.php I configured pdf page in reportview.php and put content separately in reportviewcontent.php
Yii Model On Insert, Update And Change Password
by Unknown
When I wrote code for change password in yii framework, I was written above code. In this code i used scenario for model. So the rule of models was configured based on scenari concept of yii framework.It was working fine for me.
Thursday, September 27, 2012
How To Handle CJuiTabs In Yii
by Unknown

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.
Static CJuiTabs
<?php $this->widget('zii.widgets.jui.CJuiTabs', array( 'tabs' => array( 'Tab 1' => 'Content for tab 1', 'Tab 2' => array('content' => 'Content for tab 2', 'id' => 'tab2'), // panel 3 contains the content rendered by a partial view 'AjaxTab' => array('ajax' => $this->createUrl('...')), ), // additional javascript options for the tabs plugin 'options' => array( //Click the selected tab to toggle its content closed/open. //To enable this functionality, set the collapsible option to true 'collapsible' => true, //Open CJuitabs on mouse over 'event'=>'mouseover', ), )); ?>
This is the normal CJuiTabs view in Yii framework. Just create the tab and assign content for that tab.
Here I did 3 things. They are
- Static Content for Tab l
- Static Content with ID for Tab 2
- Content added dynamically using ajax url
Render CJuiTabs
<?php $this->widget('zii.widgets.jui.CJuiTabs', array( 'tabs' => array( 'Tab 1' => 'Content for tab 1', 'Tab 2' => array('content' => 'Content for tab 2', 'id' => 'tab2'), // panel 3 contains the content rendered by a partial view 'AjaxTab' => array('ajax' => $this->createUrl('...')), // Get Content From Another page. Also Pass Parameter 'Render View'=>$this->renderPartial('_newpage', array('value'=>$value),TRUE) ), // Render view with ID 'Render View With ID'=>array( 'id'=>'renderid' 'content'=>$this->renderPartial('_newpage2', array('value'=>$value),TRUE ), ), // additional javascript options for the tabs plugin 'options' => array( 'collapsible' => true, ), 'id'=>'MyTab', )); ?>In this code, We can add content using renderPartial method in CJuiTabs. Here i added one parameter that is "value"(Optional)
Dynamic CJuiTabs
<?php $tab_list=Componenttabs::gettabs(); $tabarray=array(); $i=1; // Create Dynamic Tabs foreach($tab_list as $key=>$value){ $tabarray["Tab $i"]=array( 'id'=>$i, 'content'=>$this->renderPartial('_newpage', array('value'=>$value),TRUE) ); $i++; } $this->widget('zii.widgets.jui.CJuiTabs', array( 'tabs'=>$tabarray, 'options'=>array( 'collapsible'=>true, ), 'id'=>'categorytabs', )); ?> components/Componenttabs.php <?php class Componenttabs extends CApplicationComponent{ public static function gettabs(){ $model=Category::model()->findAll(); $listdata=CHtml::listData($model,”,’name’); return $listdata; } } ?>
This is my great work of my project. I created dynamic tabs and content.
CJuiTabs With Class(Style)
<style type='text/css' > .tabclass{ color:'red'; font-weight:bold; } </style> // Css class for dynamic CJuiTabs <?php $tabarray["<span class='tabclass'>Tab $i</span>"]=array( 'id'=>$i, 'content'=>$this->renderPartial( '_newpage', array('value'=>$value), TRUE) ); ?> // Css class for static CJuiTabs <?php $this->widget('zii.widgets.jui.CJuiTabs', array( 'tabs' => array( '<span class='tabclass'>Tab 1</span>' => 'Content for tab 1', ), )); ?>
When you create dynamic tab using $tabarray["Tab $i"], You can apply color class using span tag.
Hint: When you use more than one CJuiTabs "Dont Forget" to set "ID". Otherwise you will get some problem
Dynamic Yii CJui Tabs Menu With Color
<?php $tablist=array("Red","Green","Blue"); foreach($tablist as $tabs){ $css=''; if($tabs=='Red'){$css='color:red;';} else if($tabs=='Green'){$css='color:green;';} else if($tabs=='Blue'){$css='color:blue';} $tabarray["<span id='tab-$key' style='$css'>$tabs</span>"]="$tabs Color"; } ?> <?php $this->widget('zii.widgets.jui.CJuiTabs',array( 'tabs'=>$tabarray, 'options' => array( 'collapsible' => true, ), 'id'=>'MyTab-Menu1' )); ?>
Yii CJui Tabs Mouse Over Event
<?php $tablist=array("Red","Green","Blue"); foreach($tablist as $tabs){ $css=''; if($tabs=='Red'){$css='color:red;';} else if($tabs=='Green'){$css='color:green;';} else if($tabs=='Blue'){$css='color:blue';} $tabarray["<span id='tab-$key' style='$css'>$tabs</span>"]="$tabs Color"; } ?> <?php $this->widget('zii.widgets.jui.CJuiTabs',array( 'tabs'=>$tabarray, 'options' => array( 'event'=>'mouseover', ), 'id'=>'MyTab-Menu-Mouse' )); ?>Download Yii CJuiTabs
Thursday, July 26, 2012
Ajax Submit Button in Yii
by Unknown
This source to Apply the AjaxSubmitButton instead of submitButton in yiiYii CHtml ajaxSubmitButton I added ajaxsubmitbutton instead of submitButton. When i click the submit button I will send form data through ajax post and i will do controller work for insert and i render the listdata using CHtml::listData() and i will set the response value to eventlist dropdownlist. So I am updating the event list without page refresh using ajaxsubmitbutton of yiiFor More Details www.bsourcecode.com
Tuesday, July 24, 2012
Yii Hint For Form Radio Button
by Unknown
When you select the radio button, Form will get submit action
Monday, July 23, 2012
insert data into Dropdownlist by ajax request in yii
by Unknown
In view.php ----------------- In controller.php -----------------
Thursday, July 19, 2012
Wednesday, July 18, 2012
Yii Model Rules
by Unknown
This tutorial will help you to understand the yii model rules, user defined functions. In yii rules function I added code (of yiiframework) for unique,email,password comparison, date, phone number, trim etc.. I created user functions for alphanumeric password validation, phone number or mobile number requirements validation.
Read More...
<?php class Mytable extends CActiveRecord{ public static function model($className=__CLASS__){ return parent::model($className); } public function rules() { return array( array('status', 'numerical', 'integerOnly'=>true), array('username, password, firstname, lastname, contactno', 'length', 'max'=>45), array('gender, newsletter', 'length', 'max'=>1), /** Username validation in yii model **/ array('username', 'match' ,'pattern'=>'/^[A-Za-z0-9_]+$/u', 'message'=> 'Username can contain only alphanumeric characters and hyphens(-).'), /** Set scenario for model. Yii Scenario will help you to change dynamic validation using controller. $model=Mytable::model()->findByPk($id); //(OR) $model = new Mytable(); $model->setScenario('updateuser'); // (OR) $model->scenario ='updateuser'; **/ array('username','unique','on'=>'updateuser'), /** EMAIL VALIDATION **/ //Yii M odel Rules For Email array('emailid', 'length', 'max'=>225), array('emailid', 'email'), /** PASSWORD VALIDATION **/ //Yii Model Rules For Password Confirm array('password', 'compare', 'on'=>"confirmpassword", 'compareAttribute'=>'password'), //Yii Model alphanumeric password validation array('password','passwordalphanumeric','on'=>'changepassword'), /** DATE VALIDATION **/ //Yii Model Rules For Date Format array('dob', 'type', 'type' =>'date', 'message' => '{attribute}: is not a date!', 'dateFormat' => 'yyyy-MM-dd'), /** SIMPLE PHONE NUMBER VALIDATION **/ //Yii Model Rules For Entering Mobile Or Phone Number array('stdcode,phoneno,mobileno', 'numerical', 'integerOnly'=>true), //Validation without STD CODE NUMBER array('phoneno,mobileno','my_required'), //(OR) //Validation with STD CODE NUMBER array('phoneno,mobileno,stdcode','my_required'), /** TRIM DATA BEFORE SEND TO DATABASE **/ //Yii Model Rules For Trimming Data array('username', 'filter', 'filter'=>'trim'), /** UNIQUE VALIDATION **/ //Yii Model Rules For Unique data array('username', 'unique'), /** Yii Float Number VALIDATION **/ array('ratio', 'match', 'pattern'=>'/^[0-9]{1,3}(\.[0-9]{0,2})?$/'), /** Value In Condition **/ array('status', 'in', 'range'=>array(1,2,3)), ); } // BeforeValidate function in yii rules public function beforeValidate() { if (!$this->phoneno && !$this->mobileno) { $this->addError('mobileno', 'Enter Mobile Number Or Phone Number'); } return parent::beforeValidate(); } // User defined function //Validation without STD CODE NUMBER public function my_required($attribute_name,$params){ if(empty($this->phoneno) && empty($this->mobileno)){ $this->addError($attribute_name, 'Please enter Telephone number or Mobile number'); } } //Validation with STD CODE NUMBER public function my_required($attribute_name,$params){ if(empty($this->phoneno) && empty($this->mobileno)){ $this->addError('phoneno', 'Please enter Telephone number or Mobile number'); }else if(!empty($this->phoneno) && $this->stdcode==''){ $this->addError('stdcode','Please enter STD number'); } } // Check password with alphanumeric validation public function passwordalphanumeric($attribute_name,$params){ if(!empty($this->password)){ if (preg_match('~^[a-z0-9]*[0-9][a-z0-9]*$~i',$this->password)) { // $subject is alphanumeric and contains at least 1 number } else { // failed $this->addError($attribute_name,'Please enter password with digits'); } } } } ?>
Monday, July 16, 2012
Tuesday, July 10, 2012
Yii Hint For Files Handling
by Unknown
Files
Delete All Files Inside Directory Now All files will delete inside directoryDelete Single File Using File Path
Yii Zip Format Function
by Unknown
Create Zip Files in Yii
Extract Zip Files in Yii
Download Zip Files in Yii
Delete Zip Files in Yii
Monday, July 9, 2012
Yii Pagination Using CDbCriteria
by Unknown
Yii Pagination Using CDbCriteria
Just we need Pagenumber and limit per page Add Validation for page number, limit
Tuesday, June 19, 2012
Yii Sample Websites
by Unknown
Stay.com Free online travel service website using Yii frameworkZurmo.org Open Source CRM application is written in PHP utilizing Yii, JQuery, and RedBeanPHP and relies heavily on test driven development. It might be one of the most complex projects on Yii to date. Right now, It have 1000+ unit tests running across eight server configurations and utilize selenium for a nice set of functional tests too ect.vice.com Vice.com for best original videos, documentaries, and underground news from around the worldnutritionix.com Nutritionix was founded in March of 2010 by Matt and Danny when they realized a deficiency in available online nutritional information. We fell into the single guy routine of eating out with every meal and enjoying one too many happy hours. After gaining a few pounds and having a ten-year old beat us at pull-ups, we realized we needed to step up our game etc..hotellweb.com Hotellweb is a leader in Scandinavia within the hotel booking online. HotellWeb.no is Norwegian representative for several international booking systems that negotiate lower prices for hotels throughout the world etc..piclyf.com PicLyf is a social network around photo blogs & journals w/ photo editor, doodle & webcam.