1

我正在使用 codeigniter 2.03 及其分页类。它有一个看起来像这样的问题:

1
2
下一个 最后

这是我在控制器中的代码:

$config['base_url'] = site_url().'/admin/seesubcategory/'; //set the base url for pagination
$config['total_rows'] = $a; //total rows
$config['per_page'] = '12'; //the number of per page for pagination
$config['uri_segment'] = 3; //see from base_url. 3 for this case
$this->pagination->initialize($config); //initialize pagination
$config['num_tag_open'] = '<div id="pagination">';  
$config['num_tag_close'] = '</div>';
$config['prev_link'] = '&lt;';
$config['prev_tag_open'] = '<div>';
$config['prev_tag_close'] = '</div>';

这是我打印链接的代码:

<?php echo $this->pagination->create_links(); ?>

这是我的CSS:

#pagination a, #pagination strong {
    background: #e3e3e3;
    padding: 4px 7px;
    text-decoration: none;
    border: 1px solid #cac9c9;
    color: #292929;
    font-size: 13px;
}

#pagination strong, #pagination a:hover {
    font-weight: normal;
    background: #cac9c9;
    display: inline-block;
}
4

1 回答 1

2

你的代码应该是这样的

$config['base_url'] = site_url().'/admin/seesubcategory/'; //set the base url for pagination
$config['total_rows'] = $a; //total rows
$config['per_page'] = '12'; //the number of per page for pagination
$config['uri_segment'] = 3; //see from base_url. 3 for this case    
$config['num_tag_open'] = '<div id="pagination">';  
$config['num_tag_close'] = '</div>';
$config['prev_link'] = '&lt;';
$config['prev_tag_open'] = '<div>';
$config['prev_tag_close'] = '</div>';
$this->pagination->initialize($config); //initialize pagination

您需要在所有结束时初始化“配置”

于 2012-09-27T04:54:50.643 回答