Welcome Guest, Not a member yet? Register   Sign In
Pagination on blog
#1

[eluser]E303[/eluser]
Hi,

What I have done so far is created blog without to many problems. All of my queries are in a model.

I am now thinking about adding pagination but does that mean that my current queries for grabbing the most recent post aren't neded any more?

Also I was wanting to set up the pagination like wordpress. So "previous" & "next" instead of the page numbers.

How do I go about that?
#2

[eluser]charlieD[/eluser]
You can use the pagination class which works really well:

http://ellislab.com/codeigniter/user-gui...ation.html

There's a useful extended version which I think is called SCI_Pagination, and that lets you get the contents of the pagination as an array so you can completely customise the HTML and the way you use it.

Can that be added as a new feature to the next release? It makes things quite inflexible when you can only get the output of a library as pre-formatted HTML (even if you do have quite a lot of control over the tags etc.)
#3

[eluser]xwero[/eluser]
I think you can customize it to only next and previous but you would have to use (almost) all config options

Code:
$config['num_links'] = 0;
$config['first_link'] = '';
$config['first_tag_open'] = '';
$config['first_tag_close'] = '';
$config['last_link'] = '';
$config['last_tag_open'] = '';
$config['last_tag_close'] = '';
$config['next_link'] = 'next';
$config['prev_link'] = 'previous';
$config['cur_tag_open'] = '';
$config['cur_tag_close'] = '';
$config['num_tag_open'] = '';
$config['num_tag_close'] = '';

I guess the page number is still visible there should be an option for it to be visible or not.

If there is a next release maybe they should make the options bottom-up instead of top-down meaning you add the parts instead of removing them.
#4

[eluser]worchyld[/eluser]
There is an undocumented part of pagination, if you supply the pagination config with a cur_page option, it will remember the offset better if you are using POSTed variables;

Code:
$config['cur_page'] = $offset; // 10, 20, etc
#5

[eluser]E303[/eluser]
thanks for that... What about the SQl queries in my model. What should they be?




Theme © iAndrew 2016 - Forum software by © MyBB