in my controller I have the usual controller for in dex
public function actionIndex()
{
$dataProvider=new CActiveDataProvider('Faq');
$this->render('index',array(
'dataProvider'=>$dataProvider,
));
}
now that dataprovider gets EVERY field in my table… I would like for it to only return certain fields based on a specific condition. in this case a language flag.
how can I pass the following SQL to the provider?
sql = "SELECT faq_id, faq_title_".$lang.", faq_content_".$lang." FROM tbl_faq";
$sql = "SELECT faq_id, faq_title_".$lang.", faq_content_".$lang." FROM tbl_faq";
$dataProvider=new CSqlDataProvider($sql);
//Note: $dataProvider->getData() will return a list of arrays.
$this->render('index',array(
'dataProvider'=>$dataProvider,
));