The Yii Framework provides a sweet functionality that allows you to easily create page specific menus.
What does this mean?
This allows you to create one layout or CSS styling for your menu, and when each page is loaded, a new set of menu items is loaded in. This is useful for context specific sidebars within your application.
Uploading files in a webapp can be extremely tricky and sometimes the quickest way to do it is to store the file directly in the webserver or into a DNS (like Amazon S3) and then to save the link and the metadata inside a table in the DB. The thing is that you'll have to deal with file permissions, server storage, file management and so on (which is perfectly fine, by the way).
Countries sometimes change their laws pertaining to timezones and daylight saving times. This means that GMT+2 can be a different time this August compared to last August! However, by using php's DateTime class (instead of timestamps), we can do both "format" and "timezone" conversions on a single DateTime object (only 2 lines of code) for date, time, timestamp and datetime types - while php takes care of nightmares such as current and historical timezones and daylight saving times.
I have two tables called hospitals and departments. I have a junction table between them which holds the departments in each hospital. But sometimes I need a list of "All hospitals with All possible departments" - regardless of whether they are linked in the junction table or not.
It is difficult to perform user dependent theming through a general configuration in 'main.php'.
This article proposes a method to do so through a Factory that dynamically generates classes to allow delayed resolution of actual user values.
This means that you can refer to values that are stored in the database through the CActiveRecord before Yii is actually loaded.
The values will be fetched from the database when actually used for the first time, which is after Yii is loaded.
Actually, you can use pretty much any method that relies on Yii with this method.
You would find having such a need in most Yii Projects. Your database needs a specific format to store date fields, while you may want to display it in different formats to the users on forms and other views.