我使用Zendframework工作https://www.taskguru.co.ke/job/findproscat,现在只显示一个用户工作帖,但我喜欢在一个页面上查看页面多个工作帖子,但是当我尝试添加foreach循环时返回404错误。 。看下面的代码并帮我解决这个问题...!
控制器:
class JobController extends Zend_Controller_Action
{
public function findproscatAction(){
global $objSession ;
$this->view->pageHeading="Hire Task Guru";
$this->_helper->layout()->setLayout('profilepage');
$sort_by =$this->_getParam('sort_by');
$this->view->sort_by=$sort_by;
$jobdata = $this->generalMethod->getAllRecordFromLeftJoin('jobpost',"users","jobpost.job_postby=users.user_id","1","","");
$this->view->jobdata=$jobdata;
if(!$sort_by)
{
$sort_by=0;
}
$data = $this->modelJob->getFulltimeJoblistpro($jobdata[0],$sort_by);
$this->view->data=$data;
$this->view->setting = $this->getInviteapro();
}
}
模态:
public function getFulltimeJob($data,$sortby)
{
$this->_name = 'users';
if($sortby=='1')
{
$sortval='distance';
}
else if($sortby=='2')
{
$sortval="concat(u.user_first_name,' ',u.user_last_name) ASC";
}
else if($sortby=='3')
{
$sortval='q.qualification_passingyear';
}
else if($sortby=='4')
{
$sortval='w.workexperience_position';
}
else
{
$sortval='dt.sub_title';
}
$whr="";
if($data['job_degree_more']!='')
{
$whr=" or q.qualification_oneline IN (".$data['job_degree_more'].")";
}
$result = $this->getAdapter()->select()->from(array('u' => 'users'),array('distance'=>"(((acos(sin((".$data['user_latitude']."*pi()/180)) *
sin((`user_latitude`*pi()/180))+cos((".$data['user_latitude']."*pi()/180)) *
cos((`user_latitude`*pi()/180)) cos(((".$data['user_longitude']."- `user_longitude`)
pi()/180))))*180/pi())*60)","u.user_first_name","u.user_last_name","u.vanity_username","u.user_image","u.user_id","u.company_name"))
->joinLeft(array('q' => 'qualification'), 'u.user_id = q.qualification_uid')
->joinLeft(array('dt' => 'subdegreetitle'), 'q.qualification_oneline = dt.subtitle_id')
->joinLeft(array('d' => 'degree_title'), 'dt.title_id = d.title_id')
->joinLeft(array('vq' => 'verified_qualification'), 'q.qualification_id= vq.qualification_id',array("(CASE when user_iscompany = '0' then count(vq.qualification_id) else 4 end) as totalVQ"))
->joinLeft(array('w' => 'workexperience'), 'u.user_id= w.workexperience_uid')
->where("(q.qualification_oneline = '".$data['job_degree']."' ".$whr.") and user_type='1' and go_full_time='1' and q.qualification_status='1'")
//->where("user_type='1' and go_full_time='1' and q.qualification_status='1'")
->having("totalVQ >= 4");
$result=$result->order($sortval);
$result = $result->query()->fetchAll();
return $result;
}
我想像
一样运行foreachforeach($jobdata as $key =>$val){
$data = $this->modelJob->getFulltimeJoblistpro($jobdata[$key],$sort_by);
}
但不幸的是它给出了404错误..
请帮助我......!