我有产品的动态分页。我的分页工作正常,只是我想更好地查看我的分页。
看法:
<div style='margin-top: 10px;' class="page-link" align="center">
<?= $pagination; ?>
</div>
控制器:
function category($rowno=0)
{
$rootCatId = $this->input->get('rootCatId');
$subCatId = $this->input->get('subCatId');
$rowno = $this->input->get('per_page');
$data=array();
if($rootCatId > 0 && $subCatId== 0){
$rowperpage = 12;
if($rowno != 0){
$rowno = ($rowno-1) * $rowperpage;
}
$search_text = "";
if($this->input->post('submit') != NULL ){
$search_text = $this->input->post('search');
$this->session->set_userdata(array("search"=>$search_text));
}else{
if($this->session->userdata('search_product') != NULL){
$search_text = $this->session->userdata('search_product');
}
}
$rowperpage = 12;
if($rowno != 0){
$rowno = ($rowno-1) * $rowperpage;
}
$allcount = $this->product->getrecordCount($search_text);
$users_record = $this->product->fetchAllProductByMainCat($rootCatId,$rowno,$rowperpage,$search_text);
$config['base_url'] = base_url().'category';
$config['uri_segment'] = 3;
$config['reuse_query_string'] = TRUE;
$config['enable_query_strings'] = TRUE;
$config['page_query_string'] = TRUE;
$config['use_page_numbers'] = TRUE;
$config['total_rows'] = $allcount;
$config['per_page'] = $rowperpage;
$config['cur_tag_open'] = ' <a class="page-link">';
$config['cur_tag_close'] = '</a>';
$config['next_link'] = 'Next';
$config['prev_link'] = 'Previous';
我想显示分页看起来像下图。
我$config
为分页设置了所有必要的配置。我不知道我的代码哪里错了
繁花如伊
慕标琳琳
相关分类