<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearch/1.1/' xmlns:georss='http://www.georss.org/georss' xmlns:thr='http://purl.org/syndication/thread/1.0' xmlns:gd='http://schemas.google.com/g/2005' gd:etag='W/&quot;A0YNQnwycSp7ImA9WhdbE00.&quot;'><id>tag:blogger.com,1999:blog-5651185184265548201</id><updated>2011-10-10T21:59:53.299-07:00</updated><category term='dropDownList'/><category term='Validator'/><category term='Cient Script'/><category term='Date Picker'/><category term='Calender'/><category term='css'/><category term='MVC'/><category term='Form Tags'/><category term='style sheet'/><category term='Java Script'/><category term='Upload File'/><title>Yii Framework - Tips and Code Snippets</title><subtitle type='html'>Share tips, code snippets and experiences about Yii / Php, and discuss about best Yii practices.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://yii-framework-tips-snippets.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5651185184265548201/posts/default?redirect=false&amp;v=2'/><link rel='alternate' type='text/html' href='http://yii-framework-tips-snippets.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Sadaf Siddiqui</name><uri>http://www.blogger.com/profile/05637258661064494800</uri><email>noreply@blogger.com</email></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>7</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry gd:etag='W/&quot;DkcNQng6fCp7ImA9WhZWE0o.&quot;'><id>tag:blogger.com,1999:blog-5651185184265548201.post-6864200713946134658</id><published>2011-05-14T04:35:00.000-07:00</published><updated>2011-05-14T04:54:53.614-07:00</updated><app:edited xmlns:app='http://www.w3.org/2007/app'>2011-05-14T04:54:53.614-07:00</app:edited><category scheme='http://www.blogger.com/atom/ns#' term='Validator'/><title>Compare Validator - Entered Value Should be Greater then a Given Limit.</title><summary>Compare Validator gives large number of Comparison options  to create validation Rules in Model. Like here it validate entered value should be greater then the given limit i.e. $1 in this case.

array('offerprice','compare','compareValue'=&gt;'0.99',
      'operator'=&gt;'&gt;',
      'allowEmpty'=&gt;false , 
      'message'=&gt;'{attribute} must be at least $1'),

The CCompareValidator uses operator and </summary><link rel='replies' type='application/atom+xml' href='http://yii-framework-tips-snippets.blogspot.com/feeds/6864200713946134658/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yii-framework-tips-snippets.blogspot.com/2011/05/compare-validator-entered-value-should.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5651185184265548201/posts/default/6864200713946134658?v=2'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5651185184265548201/posts/default/6864200713946134658?v=2'/><link rel='alternate' type='text/html' href='http://yii-framework-tips-snippets.blogspot.com/2011/05/compare-validator-entered-value-should.html' title='Compare Validator - Entered Value Should be Greater then a Given Limit.'/><author><name>Sadaf Siddiqui</name><uri>http://www.blogger.com/profile/05637258661064494800</uri><email>noreply@blogger.com</email></author><thr:total>0</thr:total></entry><entry gd:etag='W/&quot;DkUGR3g_eip7ImA9WhZWE0o.&quot;'><id>tag:blogger.com,1999:blog-5651185184265548201.post-1508654348753045973</id><published>2011-05-14T01:05:00.000-07:00</published><updated>2011-05-14T04:57:06.642-07:00</updated><app:edited xmlns:app='http://www.w3.org/2007/app'>2011-05-14T04:57:06.642-07:00</app:edited><category scheme='http://www.blogger.com/atom/ns#' term='Form Tags'/><category scheme='http://www.blogger.com/atom/ns#' term='MVC'/><category scheme='http://www.blogger.com/atom/ns#' term='Upload File'/><title>How to Upload Multiple Files in Yii Forms</title><summary>Yii have very simple way to Upload Multiple Files with Jquery Interface. It include all three level integration Model , Controller and View.

Step 1 : Model 
Add Rule for File Upload Validation . Here we only allow user to upload documents with the File Extention .doc, .docx, .pdf and .txt. The same you customize for Photo or Image Upload.

array('attachments', 'file', 
'types'=&gt;'doc,docx,pdf,txt</summary><link rel='replies' type='application/atom+xml' href='http://yii-framework-tips-snippets.blogspot.com/feeds/1508654348753045973/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yii-framework-tips-snippets.blogspot.com/2011/05/how-to-upload-multiple-files-in-yii.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5651185184265548201/posts/default/1508654348753045973?v=2'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5651185184265548201/posts/default/1508654348753045973?v=2'/><link rel='alternate' type='text/html' href='http://yii-framework-tips-snippets.blogspot.com/2011/05/how-to-upload-multiple-files-in-yii.html' title='How to Upload Multiple Files in Yii Forms'/><author><name>Sadaf Siddiqui</name><uri>http://www.blogger.com/profile/05637258661064494800</uri><email>noreply@blogger.com</email></author><thr:total>1</thr:total></entry><entry gd:etag='W/&quot;A0UHSXo8fCp7ImA9WhZQF08.&quot;'><id>tag:blogger.com,1999:blog-5651185184265548201.post-1611401205109269261</id><published>2011-03-28T04:19:00.001-07:00</published><updated>2011-04-25T04:00:38.474-07:00</updated><app:edited xmlns:app='http://www.w3.org/2007/app'>2011-04-25T04:00:38.474-07:00</app:edited><category scheme='http://www.blogger.com/atom/ns#' term='MVC'/><title>How to call another View / Partial from a View File</title><summary>A template view file can open another template view in it, this view is called Partial. The underscore "_" use as prefix in the name of Template Partial File.

$this-&gt;renderPartial(
 '/adminPanel/_myPartial',
 array(
 'dataProvider'=&gt;$dataProvider,
 'pid'=&gt;$model-&gt;id
 )
 ); 

</summary><link rel='replies' type='application/atom+xml' href='http://yii-framework-tips-snippets.blogspot.com/feeds/1611401205109269261/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yii-framework-tips-snippets.blogspot.com/2011/03/how-to-call-another-view-partial-from.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5651185184265548201/posts/default/1611401205109269261?v=2'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5651185184265548201/posts/default/1611401205109269261?v=2'/><link rel='alternate' type='text/html' href='http://yii-framework-tips-snippets.blogspot.com/2011/03/how-to-call-another-view-partial-from.html' title='How to call another View / Partial from a View File'/><author><name>Sadaf Siddiqui</name><uri>http://www.blogger.com/profile/05637258661064494800</uri><email>noreply@blogger.com</email></author><thr:total>0</thr:total></entry><entry gd:etag='W/&quot;D0QHR3c4fip7ImA9WhZWE0o.&quot;'><id>tag:blogger.com,1999:blog-5651185184265548201.post-2402397750946533949</id><published>2011-03-27T06:38:00.000-07:00</published><updated>2011-05-14T05:15:36.936-07:00</updated><app:edited xmlns:app='http://www.w3.org/2007/app'>2011-05-14T05:15:36.936-07:00</app:edited><category scheme='http://www.blogger.com/atom/ns#' term='Date Picker'/><category scheme='http://www.blogger.com/atom/ns#' term='Calender'/><category scheme='http://www.blogger.com/atom/ns#' term='Form Tags'/><title>How to add Calender to a Form Text Field</title><summary>We have a Date Picker widget in Yii. 

&lt;div class="row"&gt;
&lt;?php echo $form-&gt;labelEx($model,'joinDate'); ?&gt;
&lt;?php 
$this-&gt;widget('zii.widgets.jui.CJuiDatePicker', array(
'model'=&gt;$model,
'attribute'=&gt;'joinDate',
//additional javascript options for the date picker plugin
'options'=&gt;array(
'dateFormat'=&gt;'yy-mm-dd',
'showAnim'=&gt;'fold',
'datepickerOptions'=&gt;array('changeMonth'=&gt;true, 'changeYear'=&gt;true</summary><link rel='replies' type='application/atom+xml' href='http://yii-framework-tips-snippets.blogspot.com/feeds/2402397750946533949/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yii-framework-tips-snippets.blogspot.com/2011/03/how-to-add-calender-to-form-text-field.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5651185184265548201/posts/default/2402397750946533949?v=2'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5651185184265548201/posts/default/2402397750946533949?v=2'/><link rel='alternate' type='text/html' href='http://yii-framework-tips-snippets.blogspot.com/2011/03/how-to-add-calender-to-form-text-field.html' title='How to add Calender to a Form Text Field'/><author><name>Sadaf Siddiqui</name><uri>http://www.blogger.com/profile/05637258661064494800</uri><email>noreply@blogger.com</email></author><thr:total>0</thr:total></entry><entry gd:etag='W/&quot;Dk8BQHkyeSp7ImA9WhZQEU0.&quot;'><id>tag:blogger.com,1999:blog-5651185184265548201.post-5907787849809579378</id><published>2011-03-27T05:58:00.000-07:00</published><updated>2011-04-17T22:34:11.791-07:00</updated><app:edited xmlns:app='http://www.w3.org/2007/app'>2011-04-17T22:34:11.791-07:00</app:edited><category scheme='http://www.blogger.com/atom/ns#' term='Form Tags'/><category scheme='http://www.blogger.com/atom/ns#' term='dropDownList'/><title>How to Customize dropDownList</title><summary>Add two database field in text of Select Box 
Here we are going to display a dropdown with customize text, the Html version of dropDownList :
&lt;select name="Users[id]" id="Users_id"&gt;
&lt;option value=""&gt;Choose&lt;/option&gt;
&lt;option value="1"&gt;Mike  Smith&lt;/option&gt;
&lt;option value="2"&gt;John  White&lt;/option&gt;
&lt;option value="3"&gt;Adin  Joe&lt;/option&gt;
&lt;/select&gt;
the Controller class code :
$userlist = array();
  foreach(</summary><link rel='replies' type='application/atom+xml' href='http://yii-framework-tips-snippets.blogspot.com/feeds/5907787849809579378/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yii-framework-tips-snippets.blogspot.com/2011/03/how-to-customize-dropdownlist.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5651185184265548201/posts/default/5907787849809579378?v=2'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5651185184265548201/posts/default/5907787849809579378?v=2'/><link rel='alternate' type='text/html' href='http://yii-framework-tips-snippets.blogspot.com/2011/03/how-to-customize-dropdownlist.html' title='How to Customize dropDownList'/><author><name>Sadaf Siddiqui</name><uri>http://www.blogger.com/profile/05637258661064494800</uri><email>noreply@blogger.com</email></author><thr:total>0</thr:total></entry><entry gd:etag='W/&quot;A0YNQnk9fip7ImA9WhZSEk8.&quot;'><id>tag:blogger.com,1999:blog-5651185184265548201.post-7184360954132259998</id><published>2011-03-26T23:54:00.000-07:00</published><updated>2011-03-27T05:33:13.766-07:00</updated><app:edited xmlns:app='http://www.w3.org/2007/app'>2011-03-27T05:33:13.766-07:00</app:edited><category scheme='http://www.blogger.com/atom/ns#' term='style sheet'/><category scheme='http://www.blogger.com/atom/ns#' term='css'/><title>How to add Style Sheet in view file</title><summary>Yii have similar style like Html , i add my Style Sheet file in my CSS folder and then call it from my view file
&lt;link rel="stylesheet" type="text/css" href="&lt;?php echo Yii::app()-&gt;request-&gt;baseUrl; ?&gt;/css/tabs.css" media="screen, projection" /&gt;
with this we can add specific CSS Flie in any view of Yii.</summary><link rel='replies' type='application/atom+xml' href='http://yii-framework-tips-snippets.blogspot.com/feeds/7184360954132259998/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yii-framework-tips-snippets.blogspot.com/2011/03/how-to-add-style-sheet-in-view-file.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5651185184265548201/posts/default/7184360954132259998?v=2'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5651185184265548201/posts/default/7184360954132259998?v=2'/><link rel='alternate' type='text/html' href='http://yii-framework-tips-snippets.blogspot.com/2011/03/how-to-add-style-sheet-in-view-file.html' title='How to add Style Sheet in view file'/><author><name>Sadaf Siddiqui</name><uri>http://www.blogger.com/profile/05637258661064494800</uri><email>noreply@blogger.com</email></author><thr:total>0</thr:total></entry><entry gd:etag='W/&quot;Ak4HSHYzfip7ImA9WhZQF08.&quot;'><id>tag:blogger.com,1999:blog-5651185184265548201.post-5873674958034807440</id><published>2011-03-26T23:28:00.000-07:00</published><updated>2011-04-25T03:55:39.886-07:00</updated><app:edited xmlns:app='http://www.w3.org/2007/app'>2011-04-25T03:55:39.886-07:00</app:edited><category scheme='http://www.blogger.com/atom/ns#' term='Cient Script'/><category scheme='http://www.blogger.com/atom/ns#' term='Java Script'/><title>How to Register a JavaScript File.</title><summary>Yii Framework provides a class to handle  Client Script , and we can register as many Java Script Files as we want in View File of any model. Custom Client Script file can be add with following two steps:

Add your file in your project folder. like i place it in : my-Yii-site/assets/js/tabs.js
Add this code in your View File :Yii::app()-&gt;clientScript-&gt;registerScriptFile(Yii::app()-&gt;baseUrl.'/</summary><link rel='replies' type='application/atom+xml' href='http://yii-framework-tips-snippets.blogspot.com/feeds/5873674958034807440/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yii-framework-tips-snippets.blogspot.com/2011/03/how-to-register-javascript-file.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5651185184265548201/posts/default/5873674958034807440?v=2'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5651185184265548201/posts/default/5873674958034807440?v=2'/><link rel='alternate' type='text/html' href='http://yii-framework-tips-snippets.blogspot.com/2011/03/how-to-register-javascript-file.html' title='How to Register a JavaScript File.'/><author><name>Sadaf Siddiqui</name><uri>http://www.blogger.com/profile/05637258661064494800</uri><email>noreply@blogger.com</email></author><thr:total>0</thr:total></entry></feed>