|
|
- //下一页
- $next_page = $this->db->get_one("`catid` = '$catid' AND `id`<'$id' AND `status`=99",'*','listorder DESC, id DESC');
- // 上一页下一页新的写法 开始2019 0419
- //超找附近的数据
- $around_data_1 =$this->db->select("`catid`= '$catid' AND `listorder`>'$listorder' and id!='$id' AND `status`=99",'*',1,'listorder ASC,id ASC');
- $around_data_2 = $this->db->select("`catid`= '$catid' AND `listorder`<'$listorder' AND `status`=99",'*',1,'listorder DESC, id DESC');
- $around_data_3 = $this->db->select("`catid`= '$catid' AND `id`>='$id' AND `listorder`>='$listorder' AND `status`=99",'*',2, 'listorder ASC,id ASC');
- $around_data_4 = $this->db->select("`catid`= '$catid' AND `id`<'$id' AND `listorder`<='$listorder' AND `status`=99",'*',1, 'listorder DESC, id DESC');
- $around_data_a = array_merge((array)$around_data_1,(array)$around_data_2);
- $around_data_b = array_merge((array)$around_data_3,(array)$around_data_4);
- $around_data = array_merge($around_data_a,$around_data_b);
- //将数组 按照先listorder 后 ID 降序排
- foreach ($around_data as $key => $row) {
- $around_data_volume[$key] = $row['listorder'];
- $around_data_edition[$key] = $row['id'];
- }
- array_multisort($around_data_volume, SORT_DESC, $around_data_edition, SORT_DESC, $around_data);
- // print_r($around_data);
- $current_pos = array_search($id, array_column($around_data, 'id'));
- $previous_page = $around_data[$current_pos-1];
- $next_page = $around_data[$current_pos+1];
- //上一页下一页新的写法 结束 2019 0419
复制代码
phpcms\modules\content\index.php - //内容页
- public function show() {
复制代码
|
|