Changing the width of a filter column in CGridview

I recently spent an hour or so trying to reduce the width of columns in a CGridView. As I was trying to squash the grid into a narrow space, I wanted some columns to be narrower than others. I tried … Continue reading

February 21st, 2012

Yii – Exit or End a Controller action

To exit or end processing in a controller action use the end  function Yii::app()->end(); For example; this may be used to terminate processing if invalid, incorrect or missing parameters are passed if (empty($_GET)) Yii::app()->end();

February 13th, 2012

Yii – Uploading and saving images

updated:  17-Feb-2012 A simple example of a method to upload and save images.  In this example, I created a “Photo” model that saves caption & alt text info to be displayed with the images.  If you create a similar model … Continue reading

February 5th, 2012

Date validation in Yii

Moving on from my last post on Yii validation rules for text fields, next I am going to be looking at validating dates and date ranges. The date validator CDateValidator was added to Yii in release 1.1.7 and provides an easy … Continue reading

February 1st, 2012

Yii – User defined rules for Access rights

A key part of a web application is access security. Who can see what data, who can do what actions… Continue reading

January 24th, 2012

Replace Windows Shell

If you’re like me and like the bash interface on linux then here is a really quick and easy way to replace the windows shell with a linux based bash interface. http://stackoverflow.com/a/4144747/1145818

January 20th, 2012

Yii – Relations using a non-primary key

Often mistakes you make in your database design stage come around and bite you in the butt later! My Mistake I’m just testing a new reservation system that should be going live soon and it’s looking really good, expected results … Continue reading

January 19th, 2012

Yii – Further model validation

UPDATED 26-Jan-2012 ! A brief note today to add some more specific validation to your models.  As we all know – “rubbish in == rubbish out”, so let’s get that data nice and clean, right up front! public function rules() … Continue reading

January 17th, 2012

Yii – How to customize a CGridView CbuttonColumn

Update – Delete – View I’m sure you’ve already seen and used the basic buttons in a CGridView and maybe even used the template phrases to modify the behaviours array( ‘class’=>’CButtonColumn’, ‘template’=>’{delete}{update}’, ‘buttons’=>array( ‘update’=>array( ‘url’=>’$this->grid->controller->createUrl(“/History/update”, array(“id”=>$data->primaryKey,”asDialog”=>1,”gridId”=>$this->grid->id))’, ‘click’=>’function(){$(“#cru-frame”).attr(“src”,$(this).attr(“href”)); $(“#cru-dialog”).dialog(“open”); return false;}’, … Continue reading

January 12th, 2012

Yii – Converting MySql dates to locale dates

It seems strange to me that two systems that have been around for so long and worked so closely together, do not manipulate dates in the same way. It is also so easy to waste hours of time trying to … Continue reading

January 7th, 2012