我在其中使用codeigniter
and 类(library) pagination
,为什么不在我的示例中设置column # in pagination 5
with showing
?
显示在第 5 页是->13 to 16 of 16
但#
第 5 页中的列是 -> 13 14 15。
这个问题发生在最后一个分页之前,如果最后一个分页是一行。
示例: 在此页面中,您转到第 5 页,或者这是到第 5 页的直接链接
function show($offset = 0)
{
$this->admin_model->header();
$this->load->library('pagination');
//$this->load->library('Jquery_pagination');
$config['base_url'] = base_url().'admin/accommodation/show';
$config['uri_segment'] = 4;
$config['total_rows'] = $this->db->count_all('hotel_submits');
$config['per_page'] = '3';
//$config['div'] = '#num_count'; /* Here #content is the CSS selector for target DIV */
$config['num_links'] = 10000000;
$config['full_tag_open'] = '<div id="pagination">';
$config['full_tag_close'] = '</div>';
$this->pagination->initialize($config);
$offset = (int) $offset; // just to make sure nothing funky gets in here
$data['results'] = $this->db->query("SELECT @rownum:=@rownum+1 rownum, t.*
FROM (
SELECT *
FROM hotel_submits
ORDER BY id desc
LIMIT $offset, 3
) t,
(SELECT @rownum:=0) r");
$data['offset'] = $offset;
///////////////////////////HERE-START///////////////////////////////
$curr_offset = $this->uri->segment($config['uri_segment']);
$info = 'showing: ' . ( $curr_offset + 1 ) . ' to ' ;
if( ( $curr_offset + $config['per_page'] ) < ( $config['total_rows'] -1 ) )
$info .= $curr_offset + $config['per_page'];
else
$info .= $config['total_rows'];
$info .= ' of ' . $config['total_rows'];
$data['num_count'] = $info;
///////////////////////////HERE-END///////////////////////////////
$this->load->view('admin/accommodation_submit_show', $data);
}