Turning on APC per site
The Alternative PHP Cache (APC) is commonly used with Yii applications, as it can speed up script running time by a factor of two. Compiled code is kept in shared memory for quick and easy access...
View ArticleAdding conditions to Yii model relations
Something I realised today is the power of adding conditions to model relations. This allows you to specify which records are returned as part of the relationship, which therefore allows you to set up...
View ArticleAdding Criteria To Validation Rules
Sometimes you want your validation rules to be just a little bit more than the standard options available to you like ‘numeric’, ‘length’ or ‘safe’. Occasionally you might need a value to be unique...
View ArticleYii extensions – Where to put site-wide functions?
One aspect of Yii that’s confused me in the past is where to put generic site-wide functions that you want to access throughout the application. Stuff like an encryption method or a hash generator,...
View ArticleWhat version of Yii are you running?
Ever been half way through a Yii development and thought “I wonder what version of yii am I using?” Finding out is as simple as sticking the following link into your page… print Yii::getVersion();...
View ArticleImplementing Cron jobs with Yii and CConsoleCommand
A site I’m currently building requires a bunch of Cron jobs running daily to bring in and update various bits of data. It’s the first time I’ve needed to do this within the Yii framework, and it was a...
View Articlechoose RegisterCoreScript position in page html
By default… Yii::App()->clientScript->registerCoreScript('jquery'); …will include the script tag for the jQuery core script inside the head of your page immediately before your title tag. There...
View ArticleImproving Yii CBreadcrumbs
Note: As of Yii 1.1.11 CBreadcrumbs now has more options which allow you to create Bootstrap style breadcrumbs without the method below… $this->widget('zii.widgets.CBreadcrumbs', array( 'links'...
View ArticleMySQL Global Unique IDs or GUIDs
99% of websites use databases which contain a primary key, auto incrementing id column. It’s used to link any related tables together and allows very fast select of one or more specified rows. When you...
View ArticleRemoving a file from git versioning
There are two steps to taking a file back out of any repo that you manage while not deleting it. 1) Add the file to your .gitignore file. If you don’t have one already, still a new file called...
View Article
More Pages to Explore .....