Monday, 5 November 2012

Yii Unique model validator for 2 columns


   array('jobs_id', 'unique', 'criteria' => array(
                    'condition' => '`email`=:email',
                    'params' => array(
                        ':email' => $this->email
                    )
            )),

Yii Datepicker with 30+ year range


 <?php
            $this->widget('zii.widgets.jui.CJuiDatePicker', array(
                'model' => $model,
                'attribute' => 'dob',
                'options' => array(
                    'yearRange' => "30",
                    'dateFormat' => 'yy-mm-dd',
                    'changeMonth' => 'true',
                    'changeYear' => 'true',
                    'showAnim' => 'slide',
                )
            ));
?>

Friday, 2 November 2012

Yii Register Script

<?php Yii::app()->clientScript->registerScript('qtipScript', '$(".imgTip").qtip({ style: { name: "cream", tip: true } });', CClientScript::POS_END); ?>

Wednesday, 31 October 2012

Windows 2008 IIS Server PHP Error: Missing the temporary folder to store the uploaded file


  1. Check upload_tmp_dir at php.ini
  2. Find all instances of upload_tmp_dir make sure its only one
  3. Create your own temp folder set it to the folder you created
  4. upload_tmp_dir="C:\inetpub\tmp"

Tuesday, 30 October 2012

Yii Model Match Validator


           array('keyword', 'match',
                'pattern' => '/^[a-zA-Z ]*$/',
                'message' => '{attribute} has invalid characters. Only letters are allowed.'
            )

Thursday, 25 October 2012

Yii register jQuery


<?php Yii::app()->clientScript->registerCoreScript('jquery'); ?>

Yii include JS and CSS


<?php

Yii::app()->clientScript->registerScriptFile(
        Yii::app()->baseUrl . '/js/slider/jquery.flexslider-min.js', CClientScript::POS_END
);

Yii::app()->clientScript->registerCssFile(
        Yii::app()->baseUrl . '/js/slider/flexslider.css', CClientScript::POS_HEAD
);

?>

How to configure PHP, MySQL on IIS Windows server 2008 r2


  1. Configure IIS: Enable FastCGI on Role Services
  2. Download windows php installer: http://windows.php.net/downloads/releases/php-5.3.18-nts-Win32-VC9-x86.msi
  3. On installation of PHP choose IIS with fastCGI
  4. Download MySql Windows installer: http://www.mysql.com/why-mysql/windows/