|
public function get_next_page($id='',$model='news',$catid=''){
$pre_where="id < {$id} and status=1 ";
$next_where="id > {$id} and status=1 ";
if(!empty($catid)){
$pre_where="id < {$id} and status=1 and catid={$catid}";
$next_where="id > {$id} and status=1 and catid={$catid}";
}
$pre = $this->db->select("id,title")->where($pre_where,"",false)->order_by("id","desc")->limit(1)->get($model)->row_array();
$next = $this->db->select("id,title")->where($next_where,"",false)->order_by("id","asc")->limit(1)->get($model)->row_array();
if($pre){
$data['pre_title']=$pre['title'];
$data['pre_url']=$model.'/show/'.$pre['id'].'.html';
}else{
$data['pre_title']='没有了';
$data['pre_url']='javascript:void(0)';
}
if($next){
$data['next_title']=$next['title'];
$data['next_url']=$model.'/show/'.$next['id'].'.html';
}else{
$data['next_title']='没有了';
$data['next_url']='javascript:void(0)';
}
return $data;
}
麻烦哪位大佬看下这个上下一页怎么调用出来,谢谢了,麻烦给个具体调用代码 |
|