[eluser]Unknown[/eluser]
Hello to all
I'm having a problem with the library 'Pagination'. All ties come in a 404 error (page not found).
Mereover, if I change my
Code:
$config['base_url'] = base_url().'admin/article/';
by
Code:
$config['base_url'] = base_url().'admin/article/index';
the links work .
However, I have another problem. The pagination links are on page 1 when you click on page 2 for example.
So I changed the
Code:
$config['uri_segment'] = '3';
by
Code:
$config['uri_segment'] = '4';
and then everything works fine.
I would like to know why do I make these changes so that it works.
The hierarchy of my application:
application/
----controllers/
--------admin/
------------admin.php
------------article.php
----models/
------------articles.php
----views/
--------admin/
------------content/
----------------admin.php
----------------article.php
------------includes/
----------------footer.php
----------------header.php
----------------template.php
My config's file for routes -> route.php
// application/config/routes.php
$route['admin'] = "admin/admin";
$route['admin/article'] = "admin/article";
My Controller article.php
<?PHP
class Article extends Controller {
function __construct() {
parent::Controller();
}
function index(){
$this->load->library('pagination');
$this->load->model('articles');
$config['base_url'] = base_url().'admin/article/index/';
$config['total_rows'] = $this->articles->getNumArticles();
$config['per_page'] = '2';
$config['uri_segment'] = '3';
$config['num_links'] = '4';
$this->pagination->initialize($config);
$tpl['articles'] = $this->articles->getArticles($config['per_page'], $this->uri->segment(3));
$tpl['file'] = "article";
$this->load->view('admin/includes/template',$tpl);
}
}
/* End of file article.php */
/* Location: ./system/application/controllers/admin/article.php */
I hope you understand my problem
Sorry for my English, I'm French ;-)
Pierre