Yii 1.0 Extract Zip files

Extract Zip Files Using YiiI have added the source code to extract the zip files using yii public function actionExtractfile($filename) { $filename='filename'; $zipfile=DirDetails."/filename.zip"; $zip = zip_open($zipfile); $extract=DirDetails."/newfolder"; if($zip) { if(!is_dir($extract)) mkdir($extract); while ($zip_entry = zip_read($zip)) { // if(zip_entry_name($zip_entry)==$filename) //if you need any specified file use this condition { $fp = fopen($extract."/".zip_entry_name($zip_entry), "w"); if (zip_entry_open($zip, $zip_entry, "r")) { $buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry)); fwrite($fp,"$buf"); zip_entry_close($zip_entry); fclose($fp); break; } } } zip_close($zip); } […]... Read More »

Yii 1.0 Update Zip files

Update Zip Files Using PHPI added the source code to add new file into existing zip files. public function actionUpdatezip($zipfilename,$filelist) { $destination=Yii::app()->basePath.'/files/'.$zipfilename.".zip"; $zip=new ZipArchive(); if(!$zip->open($destination)) { return false; } if($filelist) { foreach($filelist as $thefile) { $filemodel=new Filesmodle; $randno=rand(11111,99999); $filename=$randno.$thefile->name; // yii magic method $zip->addFile($thefile->tempname,$filename); //$fileext=$thefile->extensionName; //$filemodel->Size=$thefile->size; } } $zip->close(); }... Read More »

FTP File Transfer Using Yii

This tutorials will helpful to transfer the large files (or small files)  from ftp folder to your application folder. When you upload the large files (in applications), It will take some times. But if you use ftp file transfer It will transfer the files fast. Based on my experience i explained below.Create Ftp Account and Folder Add Ftp Extension Config Main.php Ftp Controller Ftp View Create Ftp Account and FolderFirst create a ftp account in […]... Read More »

How To Handle CGridview in Yii

CGridview Basic CGridview With User MethodsCGridview Css StyleCGridview CButtonColumnCGridview AjaxCGridview enableSortingImages In CGridviewLink In CGridviewCGridview Summary TextPagination Header Text And Override Pagination CSSEmpty Result TextCGridview After DeleteSupport FilesCGridview Pagination TextColumn Header In CGridviewRow Selection Or Click Event In CGridViewAdd Css Class To CGridView Table RowAdd Class Or Style For CGridView Header CellAdd Css Class To CGridView Table ColumnCGridview Filter : DropDown ListCGridView Filter: DatepickerCGridview BasicHint – For Html: When display the date, […]... Read More »

Password Generator In PHP

Password Generator In PHP. We can generate dynamic password with numeric, alphanumer etc using php. I created dynamic_password function. It will generate and return the dynamic password. You should have to send password type, length like sha1, md5 for password type and numeric value for password length.<?php function dynamic_password($type='',$length=10){   // Dynamic password function   $chars = array_merge(range(0,9), range('a','z'), range('A','Z'));   shuffle($chars);   $password = implode(array_slice($chars, 0, $length));   if($type=='md5'){ […]... Read More »

Create Widget In Yii

I have learned and created new welcome widget for my application. I have shared my working experience here.What is widget Create Widget Class Create Widget View Call Widget function What is widgetWidget is a small gadget.An application or a component of an interface, that enables a user to perform a function or access a service. Create Widget Class //Welcomewidget .php <?php class Welcomewidget extends CWidget{ public $message; public function init() { $this->message=array( 'Hai', 'Yess […]... Read More »

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() Yii findAll()Yii findAll() JoinYii Sql commandYii 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 = User::model()->find($criteria); (OR) $criteria=new CDbCriteria; $criteria->condition='userid=:userId AND status=:Status'; […]... Read More »

How To Handle CJuiTabs in Yii

I have 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 CJuiTabs | Demo Yii CJuiTabsStatic CJuiTabsRender CJuiTabsDynamic CJuiTabsCJuiTabs With Class(Style)Dynamic Yii CJui Tabs Menu With ColorYii CJui Tabs Mouse Over EventDefault Selected CJuiTabsDefault Selected CJuiTabs Using SessionStatic […]... Read More »