Thinkphp3.1.3get表单全站搜索

浏览:1485 发布日期:2015/05/04 分类:求助交流
//搜索
public function sousuo(){
$wd=I('wd');
$m=M('News');
$condition['title']=array('like',"%{$wd}%");
import('ORG.Util.Page');// 导入分页类
$count= $m->where($condition)->count();// 总记录数
$Page = new Page($count,6);// 实例化分页类
$Page->setConfig('theme', '%totalRow% %header% %nowPage%/%totalPage% 页 %first% %upPage% %prePage% %linkPage% %nextPage% %downPage% %end%');
$this->page= $Page->show();// 分页显示输出
// 进行分页数据查询 注意limit方法的参数要使用Page类的属性
$b=$m->where($condition)->order('id desc')->limit($page->firstRow.','.$page->listRows)->select();
$this->news=$b;
//print_r($b);exit;
//$this->ppt=D('Dj')->where('cid=1')->select();
$this->display('chanpinzhongxin/Products_list');
}
上面是控制器的。
<form method="get" action="{:U('sousuo')}" id="sitesearch" name="sitesearch">
<input class="vv" name="" name="wd" type="text" size="22" value=""/> <input name="" type="submit" value="" class="xx" />
</form>
这是我html页面的。
我想全部表里面搜索。现在只能在一个表搜索,并且分页要全表?该怎么做?
最佳答案
评论( 相关
后面还有条评论,点击查看>>