|
发表于 2010-7-30 17:06:59
|
显示全部楼层
本帖最后由 ares333 于 2010-7-30 17:08 编辑
PHP复制代码
<?php
class X_Pagination extends CI_Pagination {
function __construct (){
parent ::__construct ();
}
function get_page ($params = array()){
$config = array();
$config['base_url'] = site_url ();
$config['total_rows'] = 0;
$config['per_page'] = 20;
$config['uri_segment'] = 3;
$config['num_links'] = 10;
$config['full_tag_open'] = '<div class="grayr">';
$config['full_tag_close'] = '</div>';
$config['first_link'] = '首页';
$config['first_tag_open'] = '';
$config['first_tag_close'] = '';
$config['last_link'] = '最后一页';
$config['last_tag_open'] = '';
$config['last_tag_close'] = '';
$config['next_link'] = '>';
$config['next_tag_open'] = '';
$config['next_tag_close'] = '';
$config['prev_link'] = '<';
$config['prev_tag_open'] = '';
$config['prev_tag_close'] = '';
$config['cur_tag_open'] = '<span class="current">';
$config['cur_tag_close'] = '</span>';
$config['num_tag_open'] = '';
$config['num_tag_close'] = '';
$config['disable_tag_open'] = '<span class="disabled">';
$config['disable_tag_close'] = '</span>';
//覆盖默认配置
foreach($config as $key=>$value){
if(isset($params[$key]) && !empty($params[$key])){
$config[$key] = $params[$key];
}
}
$this->initialize($config);
return $this->create_links();
}
}
复制代码
PHP复制代码
class Center extends X_Controller {
private $page_config=array('per_page'=>20,'uri_segment'=>5,'base_url'=>'','total_rows'=>0);
......
复制代码
PHP复制代码
$this->data['page'] = $this->pagination->get_page($this->page_config);
复制代码
http://codehere.net/code_107.html
如果需要一直显示左导(pre_link),自己修改pagination类 |
评分
-
查看全部评分
|