|
发表于 2013-4-3 11:48:05
|
显示全部楼层
$page_size = $page_size?$page_sizethis->config->item('per_page');
$limit_from = $_GET['per_page'];
$link_str = $this->mypage->array_to_url($_GET);
$params = array(
'limit_to'=>$page_size,
'limit_from'=>$limit_from,
);
$config['base_url'] = current_url().$link_str;
if(!isset($params['limit_from'])) $params['limit_from'] = 0;
$sql_count = $db->_compile_select();
$db->limit($params['limit_to'],$params['limit_from']);
$sql = $db->_compile_select();
$count = $db->query("select count(1) as total from ($sql_count) as t ")->first_row('array');
$data = array(
'count' => $count['total'],
'list' => $db->query($sql)->result_array(),
);
$config['per_page'] = $page_size;
$config['total_rows'] = $data['count'];
$this->pagination->initialize($config);
if($ajax){
$data['page_link'] = $this->pagination->create_ajax_links();
}else{
$data['page_link'] = $this->pagination->create_links();
} |
|