如何在我的页面底部中间进行分页 [英] How to make a pagination at my page at the bottom middle

查看:201
本文介绍了如何在我的页面底部中间进行分页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法在我的网站上添加分页功能。



我尝试了什么:



load-> model('news_model');

$ this-> load-> helper('date');

//加载分页库

$ this-> load-> library('pagination');

$ this-> load-> library( 'form_validation');

}



公共函数索引($ offset = 0){



//分页配置

$ config ['base_url'] = base_url()。 'news / index /';

$ config ['total_row'] = $ this-> db-> count_all('omg_new');

$ config [ 'per_page'] = 2;

$ config ['uri_segment'] = 3;

$ config ['attributes'] = array('class'=>' pagination-link');



// Init分页

$ this-> pagination-> initialize($ config); < br $> b $ b

$ data ['title'] ='最新消息';



$ data ['news' ] = $ this-> news_model-> get_posts(FALSE,$ config ['per_page'],$ offset);





$ this-> load-> view('templates / header');

$ this-> load-> view('news / index',$ data);

$ this-> load-> view('templates / footer');

}



public功能视图($ slug = NULL){



$ data ['post'] = $ this-> news_model-> get_posts($ slug);



if(empty($ data ['post'])){
show_404();

}



$ data ['title'] = $ data ['post' ] ['title'];





$ this-> load-> view('templates / header',$ data );

$ this-> load-> view('news / view',$ data);

$ this-> load-> view( 'controller / pagination_controller');

$ this-> load-> view('newlasminie / pagination_view');

$ this-> load->查看('模板/页脚');





}



public function create(){

$ data ['title'] = $ data ['post'] ['title'];



$ this-> load-> view('templates / header',$ data);

$ this-> load-> view('news / index',$ data) ;

$ this-> load-> view('templates / footer');

}







}

Hi, I cant add a pagination features at my website.

What I have tried:

load->model('news_model');
$this->load->helper('date');
//load pagination library
$this->load->library('pagination');
$this->load->library('form_validation');
}

public function index($offset = 0){

//Pagination Config
$config['base_url'] = base_url() . 'news/index/';
$config['total_row'] =$this->db->count_all('omg_new');
$config['per_page'] = 2;
$config['uri_segment'] = 3;
$config['attributes'] = array('class' => 'pagination-link');

// Init Pagination
$this->pagination->initialize($config);

$data['title'] = 'Latest News';

$data['news'] = $this->news_model->get_posts(FALSE, $config['per_page'], $offset);


$this->load->view('templates/header');
$this->load->view('news/index', $data);
$this->load->view('templates/footer');
}

public function view($slug = NULL){

$data['post'] = $this->news_model->get_posts($slug);

if(empty($data['post'])){
show_404();
}

$data['title'] = $data['post']['title'];


$this->load->view('templates/header', $data);
$this->load->view('news/view', $data);
$this->load->view('controller/pagination_controller');
$this->load->view('newlasminie/pagination_view');
$this->load->view('templates/footer');


}

public function create(){
$data['title'] = $data['post']['title'];

$this->load->view('templates/header', $data);
$this->load->view('news/index', $data);
$this->load->view('templates/footer');
}



}

推荐答案

this-> load-> helper('date' );

//加载分页库
this->load->helper('date');
//load pagination library


this-> load-> library('pagination');
this->load->library('pagination');


this-> load-> library('form_validation');

}



公共职能指数(
this->load->library('form_validation');
}

public function index(


这篇关于如何在我的页面底部中间进行分页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆