Home > Backend Development > PHP Tutorial > thinkphp 文字 罗选 字段 都在一个表里面

thinkphp 文字 罗选 字段 都在一个表里面

WBOY
Release: 2016-06-13 12:06:30
Original
862 people have browsed it

thinkphp 文字 筛选 字段 都在一个表里面




程序代码

<br />	public function index(){<br />			$Data = M('zhaopin'); // 实例化Data数据对象<br />			import('ORG.Util.Page');// 导入分页类<br />			$count= $Data->where($map)->count();// 查询满足要求的总记录数<br />			$Page= new Page($count,20);// 实例化分页类 传入总记录数<br />			$nowPage = isset($_GET['p'])?$_GET['p']:1;<br />			$list = $Data->where($map)->order('shijian desc,id asc')->page($nowPage.','.$Page->listRows)->select();<br />			$show = $Page->show();// 分页显示输出<br />			$this->assign('count',$count);<br />			$this->assign('page',$show);// 赋值分页输出<br />			$this->assign('list',$list);// 赋值数据集<br />			$this->display(); // 输出模板<br />	}<br />
Copy after login


筛选的地方
<br /><dt>招聘职位:</dt><br /><a href="#" >全部</a><br /><volist name="list" id="vo"><br />	<a href="/index.php/Zhaopin/index/Position/{$vo[Position]}">{$vo['Position']}</a>	<br /></volist> <br /><dt>区域:</dt><br /><a href="停车场.html">全深圳</a> <br /><volist name="list" id="vo"><br />	<a href="/index.php/Zhaopin/index/Recruitment/{$vo[Recruitment]}">{$vo['Recruitment']}</a>	<br /></volist> <br />
Copy after login


内容代码
<br /><volist name="list" id="vo"><br />	<span class="jobname"   style="max-width:90%"><a href="/index.php/Zhaopin/show/id/{$vo[id]}">{$vo['Job']|mb_substr=0,8,'UTF-8'}</a></span><br />	<span style="width:30%;"><a href="/index.php/Zhaopin/show/id/{$vo[id]}">{$vo['company_name']}</a></span><br />	<span style="width:16%;">{$vo['Recruitment']}</span><br />	<span style="width:15%;">{$vo['shijian']}</span><br />			招聘人数:{$vo['hiring']}人    <br />			公司性质:{$vo['Nature']}    <br />			规模:{$vo['company_scale']}人    <br />			经验:{$vo['Work_experience']}年    <br />			学历:{$vo['Degree_required']}    <br />			职位月薪:{$vo['salary']}元/月<br />		岗位要求: {$vo['Job_requirements']|mb_substr=0,150,'UTF-8'}<br />	<a href="/index.php/Zhaopin/show/id/{$vo[id]}" class="getjob">查看职位</a></dd><br /></volist><br />
Copy after login

------解决思路----------------------
<br />public function index(){<br />        $Data = M('zhaopin'); // 实例化Data数据对象<br />        import('ORG.Util.Page');// 导入分页类<br /><span style="color: #FF0000;">       <br />        $map="1=1 ";//初始化条件变量<br />        $Position=$this->_param('Position');//接收参数<br />        $Recruitment=$this->_param('Recruitment');//接收参数<br />        if($Position<>''){<br />	        $map.=" and Position='$Position'";<br />        }<br />        if($Recruitment<>''){<br />	        $map.=" and Recruitment='$Recruitment'";<br />        }<br /></span><br />        $count= $Data->where($map)->count();// 查询满足要求的总记录数<br />        $Page= new Page($count,20);// 实例化分页类 传入总记录数<br />        $nowPage = isset($_GET['p'])?$_GET['p']:1;<br />        $list = $Data->where($map)->order('shijian desc,id asc')->page($nowPage.','.$Page->listRows)->select();<br />        $show = $Page->show();// 分页显示输出<br />        $this->assign('count',$count);<br />        $this->assign('page',$show);// 赋值分页输出<br />        $this->assign('list',$list);// 赋值数据集<br />        $this->display(); // 输出模板<br />}<br />
Copy after login

大概是这个样子,楼主看看是否有用

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template