|
这是一个模型MODEL 的函数
function getSearchUsername()
{
$datas = array();
if($this->username)
{
$username = $this->username;
$getResult = $this->db->query("SELECT S.uid,S.username,S.position,S.userlevel,S.cid,S.depid,S.gender,S.email,S.telephone,S.mobile,S.qq,C.cityname,D.depname FROM ".$this->db->dbprefix('staffs')." AS S,".$this->db->dbprefix('cities')." AS C,".$this->db->dbprefix('departments')." AS D WHERE S.cid = C.cid AND S.depid = D.depid AND S.userlevel IN ('staff','head','manager') AND S.username LIKE '%".$username."%' ORDER BY uid ASC");
$resNum = $getResult->num_rows();
if($resNum > 0)
{
$index = 0;
foreach($getResult->result() as $item)
{
$resultDatas[$index] = array(
'uid' => $item->uid,
'username' => $item->username,
'position' => $item->position,
'city' => $item->cityname,
'department' => $item->depname,
'gender' => $item->gender == 0 ? '女' : '男',
'mobile' => $item->mobile,
'telephone' => $item->telephone,
'qq' => $item->qq,
'email' => $item->email,
'operation' => $this->getOperation('total',$item->uid)
);
$index++;
}//end foreach.
}
else
{
$resNum = 0;
$resultDatas = array();
}//end else.
$datas['statistic'] = $resNum;
$datas['getResult'] = $resultDatas;
return $datas;
}
}//end method.
然后控制
$getStaffContacts = $this->user->getStaffContacts();
$data['statistic'] = $getStaffContacts['statistic'];
$data['pagination'] = $getStaffContacts['pagination'];
$data['getResult'] = $getStaffContacts['getResult'];
$this->load->view('cpanelHeader');
$this->parser->parse('comdirectory',$data);
$this->load->view('cpanelFooter');
然后再试图
{getResult}
<TR onMouseOver="this.style.backgroundColor='#EFF7FF'" onMouseOut="this.style.backgroundColor='#FFFFFF'">
<TD align="center" width="5%"><strong>{uid}</strong></TD>
<TD align="left" width="10%">
<a href="#" onClick="showpm(event,this)" id="pm_view_{uid}" class="bold" title="点击显示工作单详情">
{username}</a>
{/getresult}
这里面{getresult}是怎么用的,还有{username} |
|