Hi need help!
in my table i have
dept
value
businesses
engineering
engineering
agriculture
businesses
now here’s the situation I want it to display them without duplication! it should show 1 bus., 1 engr., and 1 agriculture.
//my view code
$this->beginWidget('zii.widgets.CPortlet', array(
'title'=>'Dept',
));
$listpage=dept::model()->findAll();
foreach ($listpage as $listpage){
$models2 = dept::model()->findBypk($listpage->id);
$mysidebar[] = $models2->getAlldept();
}
$this->widget('zii.widgets.CMenu',array(
'items'=>$mysidebar,
'htmlOptions'=>array('class'=>'operations'),
));
public function getAlldept() {
$sidebar =array('label'=>$this->dept_user, 'url'=>array('/dept/index', 'pid'=>$this->dept_user));
return $sidebar;
}