You are not logged in.
- Topics: Active | Unanswered
Pages: 1
#1 2009-06-30 19:36:33
- Xzorg6
- Member
- Registered: 2008-05-09
- Posts: 26
- Website
Paginate
Hi,
Can you add the same paginate function in 1.4 as in 1.3 ?
I means with the "previous" and "next" links.
Besides, it's useful for the forum to be compatible with firefox extension AutoPager.
Actually, I mods my 1.2 forum like this :
function paginate($num_pages, $cur_page, $link_to)
{
$pages = array();
$link_to_all = false;
// If $cur_page == -1, we link to all pages (used in viewforum.php)
if ($cur_page == -1)
{
$cur_page = 1;
$link_to_all = true;
}
if ($num_pages <= 1)
$pages = array('<strong>1</strong>');
else
{
// Add a previous page link
if ($num_pages > 1 && $cur_page > 1)
{
$pages[] = '<a href="'.$link_to.'&p='.($cur_page-1).'">«</a>';
}
if ($cur_page > 3)
{
$pages[] = '<a href="'.$link_to.'&p=1">1</a>';
if ($cur_page != 4)
$pages[] = '…';
}
// Don't ask me how the following works. It just does, OK? :-)
for ($current = $cur_page - 2, $stop = $cur_page + 3; $current < $stop; ++$current)
{
if ($current < 1 || $current > $num_pages)
continue;
else if ($current != $cur_page || $link_to_all)
$pages[] = '<a href="'.$link_to.'&p='.$current.'">'.$current.'</a>';
else
$pages[] = '<strong>'.$current.'</strong>';
}
if ($cur_page <= ($num_pages-3))
{
if ($cur_page != ($num_pages-3))
$pages[] = '…';
$pages[] = '<a href="'.$link_to.'&p='.$num_pages.'">'.$num_pages.'</a>';
}
// Add a next page link
if ($num_pages > 1 && !$link_to_all && $cur_page < $num_pages)
{
$pages[] = '<a href="'.$link_to.'&p='.($cur_page+1).'">»</a>';
}
}
return implode(' ', $pages);
}Signs avoid to change language files.
Thanks
Offline
#2 2009-07-01 06:44:00
- Mpok
- Member

- From: France
- Registered: 2008-05-12
- Posts: 302
Re: Paginate
Didn't look at the code above, but i aggree on the feature : "next" and "previous" links are an easy feature to implement, and SO MUCH appreciated by users...
Offline
#3 2009-07-16 19:04:04
- Xzorg6
- Member
- Registered: 2008-05-09
- Posts: 26
- Website
Re: Paginate
No response from the dev team... ![]()
Offline
#4 2009-07-16 21:07:13
- FSX
- Developer

- From: NL
- Registered: 2008-05-09
- Posts: 803
- Website
Re: Paginate
Will be added soon. ![]()
Offline
#5 2009-07-16 21:12:10
- Xzorg6
- Member
- Registered: 2008-05-09
- Posts: 26
- Website
Re: Paginate
Thanks a lot ![]()
Offline
#6 2009-07-19 11:14:45
- Koos
- Member

- Registered: 2008-05-09
- Posts: 51
- Website
Re: Paginate
Please reconsider the use of the previous/next links in pagination. I think it's bit of an eyesore and takes up too much space:
Previously:

Now:

And when you've got many pages:
Previously:

Now:

Offline
#7 2009-07-19 11:26:40
- Xzorg6
- Member
- Registered: 2008-05-09
- Posts: 26
- Website
Re: Paginate
You can change the word in the language file if you want...
I use signs « and » on my forum : Example
As I say on the first post.
Thus, in some language, as french words ("Précédente" and "Suivante"), that takes more space.
Last edited by Xzorg6 (2009-07-19 11:35:28)
Offline
#8 2009-07-20 16:27:49
- Koos
- Member

- Registered: 2008-05-09
- Posts: 51
- Website
Re: Paginate
Thanks for your response Xzorg6, but I am talking about the default forum behavior.
Offline
#9 2009-07-20 18:31:13
- MattF
- Member

- From: South Yorkshire, England
- Registered: 2008-05-06
- Posts: 1,230
- Website
Re: Paginate
Would it not be better to make the default as was with the new format being a selectable option? Personally, I agree with Koos. I much prefer the old format.
Screw the chavs and God save the Queen!
Offline
#10 2009-07-23 20:50:33
- Koos
- Member

- Registered: 2008-05-09
- Posts: 51
- Website
Re: Paginate
So has a final decision been taken on this matter?
Offline
#11 2009-07-23 21:53:44
- trichome
- Member
- Registered: 2008-05-22
- Posts: 42
Re: Paginate
Maybe just add in some classes so the links can be hidden/styled via CSS?
Offline
#12 2009-07-25 19:34:12
- xSDMx
- Member
- Registered: 2008-06-24
- Posts: 129
Re: Paginate
Just keep the original, and add a small entry field for the page to the right of the numbers - everyone wins!
Offline
#13 2009-07-25 20:58:06
- Paul
- Developer
- From: Wales, UK
- Registered: 2008-04-27
- Posts: 1,623
Re: Paginate
I think next and previous links have become standard. I certainly expect to see them whenever I'm viewing paginated content. If they are too verbose in some languages then its just a matter of substituting + and - in the langauge file or whatever symbol you happen to prefer (laquo and raquo or not really a good idea as I think most people would read those as first and last, better just to use < and >).
The only thing worse than finding a bug is knowing I created it in the first place.
Offline
#14 2009-07-26 21:31:54
- MattF
- Member

- From: South Yorkshire, England
- Registered: 2008-05-06
- Posts: 1,230
- Website
Re: Paginate
I think next and previous links have become standard. I certainly expect to see them whenever I'm viewing paginated content. If they are too verbose in some languages then its just a matter of substituting + and - in the langauge file or whatever symbol you happen to prefer (laquo and raquo or not really a good idea as I think most people would read those as first and last, better just to use < and >).
They're obviously stopping in, by the sounds of it, so would it not be best to at least put them in span tags or suchlike, (if they aren't already), so that they can at least be hidden if desired?
Screw the chavs and God save the Queen!
Offline
#15 2009-07-27 14:47:09
- quy
- Developer
- From: California
- Registered: 2008-05-09
- Posts: 735
Re: Paginate
...so that they can at least be hidden if desired?
Change the language entries for Previous/Next links to an empty string.
Offline
#16 2009-07-27 15:31:50
- Paul
- Developer
- From: Wales, UK
- Registered: 2008-04-27
- Posts: 1,623
Re: Paginate
Mattf: in the end it will be upto the devs whether they stay in or not. I was just offering an opinion.
The only thing worse than finding a bug is knowing I created it in the first place.
Offline
#17 2009-07-27 17:10:43
- MattF
- Member

- From: South Yorkshire, England
- Registered: 2008-05-06
- Posts: 1,230
- Website
Re: Paginate
MattF wrote:...so that they can at least be hidden if desired?
Change the language entries for Previous/Next links to an empty string.
That's my muppet moment for the week highlighted and done. ![]()
Mattf: in the end it will be upto the devs whether they stay in or not. I was just offering an opinion.
Apologies.
I thought you were still the one who had final say on all things markup related. ![]()
Just out of curiosity, what other benefits, (other than the obvious visual markers), do those prev/next links have?
Screw the chavs and God save the Queen!
Offline
#18 2009-07-27 18:31:27
- Paul
- Developer
- From: Wales, UK
- Registered: 2008-04-27
- Posts: 1,623
Re: Paginate
A large target area to hit. That of course could be remedied by making the numbered links larger like 1.3. I think there is a possible accessibility benefit where there is a large number of pages. Somebody using a screenreader might loose track of which page they are on and if that happens hitting next solves the problem.
Changing the language strings to empty is not a good idea, not unless the generation of the links was made conditional upon the langauge string having a value. Otherwise you would end up with an empty link tag. I would actually prefer making them vanish with css which leaves them in place for screenreaders and text browsers. If the link tag were given a class then it would also be possible to substitute a background img (an arrow or something) as well as making them vanish. You just give the link zero width which removes the text and enough left/right padding for the graphic.
The only thing worse than finding a bug is knowing I created it in the first place.
Offline
#19 2009-07-28 04:12:32
- MattF
- Member

- From: South Yorkshire, England
- Registered: 2008-05-06
- Posts: 1,230
- Website
Re: Paginate
Cheers for that explanation Paul. ![]()
Screw the chavs and God save the Queen!
Offline
#20 2009-08-15 17:59:05
- Koos
- Member

- Registered: 2008-05-09
- Posts: 51
- Website
Re: Paginate
I think next and previous links have become standard. I certainly expect to see them whenever I'm viewing paginated content. If they are too verbose in some languages then its just a matter of substituting + and - in the langauge file or whatever symbol you happen to prefer (laquo and raquo or not really a good idea as I think most people would read those as first and last, better just to use < and >).
That would look much better - if 'Previous' and 'Next' in the lang file could just be replaced with < and > as you mentioned. Invision Power Board and vBulletin also display their previous and next links by using < and >. Could this change perhaps be made in the core?
Offline
#21 2009-08-24 15:45:39
- Koos
- Member

- Registered: 2008-05-09
- Posts: 51
- Website
Re: Paginate
Would be nice to hear other peoples thoughts on this. Like I said above: I think using < and > for the previous and next links would look much cleaner and take up less space.
Compare:

with:

Offline
Pages: 1
