We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Pagination

Development and Programming

davy_yg's avatar
davy_yg
76 posts
12 years ago
davy_yg's avatar davy_yg

How to create pagination? If I have to write this code in the controllers, what should I write in the view folder ?

controllers/pagination.php

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

$config['base_url'] = 'http://example.com/index.php/test/page/';
$config['total_rows'] = 200;
$config['per_page'] = 20;

$this->pagination->initialize($config);

echo $this->pagination->create_links();
       
PravinS's avatar
PravinS
123 posts
12 years ago
PravinS's avatar PravinS

write this part in controller

$this->load->library('pagination');
$config['base_url'] = 'http://example.com/index.php/test/page/';
$config['total_rows'] = 200;
$config['per_page'] = 20;
$this->pagination->initialize($config);

and this in view

echo $this->pagination->create_links();
       
davy_yg's avatar
davy_yg
76 posts
12 years ago
davy_yg's avatar davy_yg

I create:

views/pagination_view.php

<html>

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


</html>

And try to load it: http://localhost/CodeIgniter_214/index.php/pagination_view/

404 Page Not Found

The page you requested was not found.

Why it it ?

       
PravinS's avatar
PravinS
123 posts
12 years ago
PravinS's avatar PravinS

you have to call controller like this

http://localhost/CodeIgniter_214/index.php/pagination/

check this url

http://ellislab.com/codeigniter/user-guide/general/controllers.html

       
davy_yg's avatar
davy_yg
76 posts
12 years ago
davy_yg's avatar davy_yg

I try: http://localhost/CodeIgniter_214/index.php/pagination/

This is the result:

404 Page Not Found

The page you requested was not found.

       
davy_yg's avatar
davy_yg
76 posts
12 years ago
davy_yg's avatar davy_yg

I find out why:

I forget to load :

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

Thanks.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.