A very simple way to maintain date-time stamps on records is to use the behaviors method in the data Model, linked with the CTimestampbehavior within Zii widgets. To implement this, in each of your data models, use a behaviors function as follows:- ...
Blog
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc ex sem, facilisis sed viverra nec, sagittis vel quam nulla nisi mi scelerisque quis.
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 manipulate dates, check that date A is less than date B and so on......
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 but sometimes we need to break out of this box and create custom buttons for...
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! The address regex pattern is using a short-code \w...
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 are bang on, the system is nice and...
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 method to validate that a field contains a...
Yii – simple email and mail merge
I needed an email mechanism for a customer that was light and easy to configure. Yii extensions I tried several email extensions from the Yii website all of which I found overly complex to setup and use. I then remembered that I had used a simple class on a PHP...
Yii – How to customize a CGridView CbuttonColumn – part 2
Part 2 (see part 1 here) Always set the class to CButtonColumn. The 'template' option enables you to name your buttons as you wish. Yii understands the basic crud names of 'update', 'view' and 'delete' but you can specify custom names as you wish as I...
Yii – Separation of admin controllers from public controllers
There are a number of posts and Wiki's on this subject and I love all the discussions and frays that you get on the Yii Framework forum. One of the popular methods is to move your Admin functions into a module, but for me this can lead to confusion and duplication,...
Subscribe