yii: default value for date picker field and CJuiDatePicker

by prettyscripts on 2012-01-24 14:28:00 • Leave a comment »

phpyii

setting a default date value to a date picker field is not so straightforward. as in, simply set a property for the CJuiDatePicker widget. there are 2 ways to do it. these are based on some forum posts i found a while ago. method 1 - give the attribut… more »

Tags: date, default, php, yii

yii: autocomplete field with CJuiAutoComplete

by prettyscripts on 2012-01-20 14:17:00 • Leave a comment »

phpyii

i have previously written a post on the same topic with CAutoComplete. since CAutoComplete is depreciated (since V113) and replaced with CJuiAutoComplete, i should keep my notes up-to-dated. i find that this is easier to implement. i found a solution b… more »

Tags: ajax, autocomplete, jquery, php, yii

yii: save empty field as null

by prettyscripts on 2012-01-18 10:52:00 • Leave a comment »

phpyii

this is an updated post in reference to a previous post about saving a field to null when no value is entered. thanks to those who left comment, this is the correct (and easier!) way to do it. add a new rule to the model: protected funcion rules() {… more »

Tags: code, null, php, save, yii

css: add text before or after

by prettyscripts on 2011-12-19 12:09:00 • Leave a comment »

css

use :before and :after psuedo elements with css property content. eg, to separate a list of items with '|': li:after { content: ' | '; } li:last-child:after { content: ''; } note line 2: no separater after the last item in the list. more »

Tags: content, css, text

mysql: import csv data

by prettyscripts on 2011-12-16 10:47:00 • Leave a comment »

sql

there are a few ways to to it. here's a solution using load data. load data local infile '/path/to/csvfile' fields terminated by ',' enclosed by '"' lines terminated by '\n' [ignore 1 lines] [(column_1, @dummy, column_2,...)] notes line 5: t… more »

Tags: csv, data, import, mysql, sql