Friday, 15 February 2013

php - Yii - DB two column data display at once -



php - Yii - DB two column data display at once -

how display db info @ 1 time different column?

this yii dropdown:

echo chtml::dropdownlist('select_gamecat',"", chtml::listdata(gamestype::model()->findall(), 'id', 'descr_en', 'descr'), //<--here array( 'empty' => yii::t('labels', 'choosecat'), 'id' => "select_gamecat", 'class' => "inputs", 'style'=>'width:369px' ));

i wish combine 'descr_en' , 'descr'

i tried 'desrc_en.desrc' , 'desrc_en + desrc' both doesn't work.

any suggestion ?

you can seek anonymous function:

echo chtml::dropdownlist('select_gamecat',"", chtml::listdata(gamestype::model()->findall(), 'id', function($data){ homecoming $data->descr_en.$data->descr; }), array('empty' => yii::t('labels', 'choosecat'),'id' => "select_gamecat", 'class' => "inputs",'style'=>'width:369px'));

explaination

yii check if 3rd parameter anonymous function, if yes, run (with call_user_func) , first parameter current model.

php yii

No comments:

Post a Comment