Wiki

Articles in category "how-tos", sorted by commentsX
Displaying 141-150 of 350 result(s).

Drop down list with enum values for column of type ENUM >+> incorporate into giix

Created 4 years ago by c@cbaHow-tos3 comments – viewed 32,521 times – ( +14 ) – version 1.1
Let's say our table 'mug' has a column named 'color' of the type ENUM('red','green','blue'). We want to replace the textfield for the attribute color in the create and update forms of a 'mug' with a drop down list, which has the enum values as options. The main code was contributed by zaccaria in the forum (see this post).

Load data from internal/external source to fill form fields

Created about a year ago by skwordenHow-tos3 comments – viewed 8,898 times – ( +1 ) – version 2.0
This wiki is to show you how to use jQuery get and JSON to get data from a dropdown/any form field and fill form fields with the values instantaneously. First, I'll give example use cases of what I'm going to teach you so you can quickly see if this is for you.

How to extend CFormatter, add i18n support to booleanFormat and use it in CDetailView

Created 4 years ago by c@cbaHow-tos3 comments – viewed 11,755 times – ( +9 ) – version 1.1
As you know, the CDetailView widget displays details of a single model. If no formatting is specified, boolean values that are stored in the database as 0 and 1, are represented in the detail view as 0 and 1. If formatted as boolean, they are represented as 'No' and 'Yes'. We want to add i18n support, so that Yes and No appear in the current language.

i18n All-in-one format and timezone conversions for date, time, timestamp and datetime.

Created 2 years ago by Gerhard LiebenbergHow-tos3 comments – viewed 18,324 times – ( +8 / -1 ) – version 1.1
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.

Remove Byte Order Mark (BOM) from files recursively

Created 2 years ago by Kostas Apazidis (KonApaz)How-tos3 comments – viewed 13,263 times – ( +5 / -1 ) – version all
Ok, this wiki is not only for yii projects.

Using loginRequiredAjaxResponse to solve ajax session timeout

Created 4 years ago by RutgerHow-tos3 comments – viewed 24,727 times – ( +13 ) – version 1.1
This solution requires Yii 1.1.9 or above

Use phing to make Yii application "installable"

Created 4 years ago by sensorarioHow-tos3 comments – viewed 8,843 times – ( +7 ) – version 1.1
To use this "how-to", you need to install phing in your machine.
tags: phing

Upload files in Yii2 with MongoDb and GridFs

Created 2 years ago by edoardo849How-tos3 comments – viewed 15,629 times – ( +8 ) – version 2.0
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).

Setting and getting systemwide static parameters

Created 5 years ago by Steve FriedlHow-tos3 comments – viewed 92,594 times – ( +12 ) – version 1.1
Occasionally one wishes to set systemwide parameters for an application, such as a contact address for email, an application name, or setting an option that guides major behavior. Yii provides for setting of static parameters in the configuration file, and this article talks about how to do it conveniently.
tags: config

Enforcing "You must agree" requirements in forms

Created 5 years ago by Steve FriedlHow-tos3 comments – viewed 21,672 times – ( +29 ) – version 1.1
Checkboxes have two possible values, true and false, but some applications require that the user select one particular value before proceeding. Examples might be:
tags: validation