Simple Machines Community Forum

SMF Development => Feature Requests => Applied or Declined Requests => Topic started by: c5Quad on December 09, 2007, 08:22:49 PM

Title: <Next Page> tag on messages with multiple pages
Post by: c5Quad on December 09, 2007, 08:22:49 PM
I would like to see a <Next Page> (or something similar) on messages with multiple pages so you don't have to click on the next number to go to the next page.
Title: Re: <Next Page> tag on messages with multiple pages
Post by: Oldiesmann on December 12, 2007, 12:02:10 PM
How would clicking "Next Page" be any different than clicking the next number in the list?
Title: Re: <Next Page> tag on messages with multiple pages
Post by: karlbenson on December 15, 2007, 10:02:50 AM
It might also get a little confusing since there is already a next and previous link on the page to take the user to the prev next topic.
Title: Re: <Next Page> tag on messages with multiple pages
Post by: c5Quad on January 07, 2008, 09:59:33 PM
I was thinking more of like this:
________________________________
|1 of 5 | 1 | 2 | 3 | <NEXT><LAST> |
------------------------------------

Some people do not have the dexterity to click the small numbers.  And with voice dictation i.e. Dragon NaturallySpeaking, they could just say next instead of the numbers, which is sometimes hard for voice dictation to understand.  In my example I don't think people would be  about the links between the next page and the next article.  Just a thought, not a major issue.
Title: Re: <Next Page> tag on messages with multiple pages
Post by: nwobhm on September 28, 2008, 08:04:25 AM
Quote from: c5Quad on January 07, 2008, 09:59:33 PM
I was thinking more of like this:
________________________________
|1 of 5 | 1 | 2 | 3 | <NEXT><LAST> |
------------------------------------

Some people do not have the dexterity to click the small numbers.  And with voice dictation i.e. Dragon NaturallySpeaking, they could just say next instead of the numbers, which is sometimes hard for voice dictation to understand.  In my example I don't think people would be  about the links between the next page and the next article.  Just a thought, not a major issue.
This is kind old topic, but this is just what I was looking for.
This next-previous -page buttons would make browsing with cellphone bit easier.

Or can I convert those next - previous topic buttons to point to a page not topic?
Title: Re: <Next Page> tag on messages with multiple pages
Post by: Antechinus on March 16, 2010, 09:24:35 PM
I've been looking for this functionality for a mobile theme I'm working on. I've sorted the coding for 1.1.11 and 2.0 RC3. This works on all templates.

I adapted the coding from this post (http://www.simplemachines.org/community/index.php?topic=116599.msg746063#msg746063) and changed it to suit my preferences.

Changes are:

1/ I omitted the code for "First page" and "Last page" links as I thought they were redundant and added too much clutter. First page can be accessed from the linktree anyway. Last page can be accessed from the last number in the pages string, or several other ways depending on which page you are on (reverse sorting options, last post icons, reply button, etc).

2/ "Previous page" link only displays if there is more than one page and you are not on the first page.

3/ "Next page" link only displays if there is more than one page and you are not on the last page.

For Subs.php in 1.1.11 the code is:

{
// If they didn't enter an odd value, pretend they did.
$PageContiguous = (int) ($modSettings['compactTopicPagesContiguous'] - ($modSettings['compactTopicPagesContiguous'] % 2)) / 2;

$pageindex = '';

// Show 'Prev'
if ($start >= $num_per_page)
$pageindex .= sprintf($base_link, $start - $num_per_page, ' <b>&#171; Previous page</b>');

// Show the first page. (>1< ... 6 7 [8] 9 10 ... 15)
if ($start > $num_per_page * $PageContiguous)
$pageindex .= sprintf($base_link, 0, '1');
else
$pageindex .= '';

// Show the ... after the first page.  (1 >...< 6 7 [8] 9 10 ... 15)
if ($start > $num_per_page * ($PageContiguous + 1))
$pageindex .= '<b> ... </b>';

// Show the pages before the current one. (1 ... >6 7< [8] 9 10 ... 15)
for ($nCont = $PageContiguous; $nCont >= 1; $nCont--)
if ($start >= $num_per_page * $nCont)
{
$tmpStart = $start - $num_per_page * $nCont;
$pageindex.= sprintf($base_link, $tmpStart, $tmpStart / $num_per_page + 1);
}

// Show the current page. (1 ... 6 7 >[8]< 9 10 ... 15)
if (!$start_invalid)
$pageindex .= '[<b>' . ($start / $num_per_page + 1) . '</b>] ';
else
$pageindex .= sprintf($base_link, $start, $start / $num_per_page + 1);

// Show the pages after the current one... (1 ... 6 7 [8] >9 10< ... 15)
$tmpMaxPages = (int) (($max_value - 1) / $num_per_page) * $num_per_page;
for ($nCont = 1; $nCont <= $PageContiguous; $nCont++)
if ($start + $num_per_page * $nCont <= $tmpMaxPages)
{
$tmpStart = $start + $num_per_page * $nCont;
$pageindex .= sprintf($base_link, $tmpStart, $tmpStart / $num_per_page + 1);
}

// Show the '...' part near the end. (1 ... 6 7 [8] 9 10 >...< 15)
if ($start + $num_per_page * ($PageContiguous + 1) < $tmpMaxPages)
$pageindex .= '<b> ... </b>';

// Show the last number in the list. (1 ... 6 7 [8] 9 10 ... >15<)
if ($start + $num_per_page * $PageContiguous < $tmpMaxPages)
$pageindex .= sprintf($base_link, $tmpMaxPages, $tmpMaxPages / $num_per_page + 1);

// Show 'Next'.
$display_page = ($start + $num_per_page) > $max_value ? $max_value : ($start + $num_per_page);
if (($display_page <= $tmpMaxPages)&&($tmpMaxPages > 1))
$pageindex .= sprintf($base_link, $display_page, '<b>Next Page &#187;</b>');

}


For 2.0 RC3 in Subs.php the code is:

{
// If they didn't enter an odd value, pretend they did.
$PageContiguous = (int) ($modSettings['compactTopicPagesContiguous'] - ($modSettings['compactTopicPagesContiguous'] % 2)) / 2;

$pageindex = '';

// Show 'Prev'
if ($start >= $num_per_page)
$pageindex .= sprintf($base_link, $start - $num_per_page, ' <b>&#171; Previous page</b>');

// Show the first page. (>1< ... 6 7 [8] 9 10 ... 15)
if ($start > $num_per_page * $PageContiguous)
$pageindex .= sprintf($base_link, 0, '1');
else
$pageindex .= '';

// Show the ... after the first page.  (1 >...< 6 7 [8] 9 10 ... 15)
if ($start > $num_per_page * ($PageContiguous + 1))
$pageindex .= '<span style="font-weight: bold;" onclick="' . htmlspecialchars('expandPages(this, ' . JavaScriptEscape($base_url . ';start=%1$d') . ', ' . $num_per_page . ', ' . ($start - $num_per_page * $PageContiguous) . ', ' . $num_per_page . ');') . '" onmouseover="this.style.cursor = \'pointer\';"> ... </span>';

// Show the pages before the current one. (1 ... >6 7< [8] 9 10 ... 15)
for ($nCont = $PageContiguous; $nCont >= 1; $nCont--)
if ($start >= $num_per_page * $nCont)
{
$tmpStart = $start - $num_per_page * $nCont;
$pageindex.= sprintf($base_link, $tmpStart, $tmpStart / $num_per_page + 1);
}

// Show the current page. (1 ... 6 7 >[8]< 9 10 ... 15)
if (!$start_invalid)
$pageindex .= '[<strong>' . ($start / $num_per_page + 1) . '</strong>] ';
else
$pageindex .= sprintf($base_link, $start, $start / $num_per_page + 1);

// Show the pages after the current one... (1 ... 6 7 [8] >9 10< ... 15)
$tmpMaxPages = (int) (($max_value - 1) / $num_per_page) * $num_per_page;
for ($nCont = 1; $nCont <= $PageContiguous; $nCont++)
if ($start + $num_per_page * $nCont <= $tmpMaxPages)
{
$tmpStart = $start + $num_per_page * $nCont;
$pageindex .= sprintf($base_link, $tmpStart, $tmpStart / $num_per_page + 1);
}

// Show the '...' part near the end. (1 ... 6 7 [8] 9 10 >...< 15)
if ($start + $num_per_page * ($PageContiguous + 1) < $tmpMaxPages)
$pageindex .= '<span style="font-weight: bold;" onclick="expandPages(this, \'' . ($flexible_start ? strtr($base_url, array('\'' => '\\\'')) : strtr($base_url, array('%' => '%%', '\'' => '\\\'')) . ';start=%1$d') . '\', ' . ($start + $num_per_page * ($PageContiguous + 1)) . ', ' . $tmpMaxPages . ', ' . $num_per_page . ');" onmouseover="this.style.cursor=\'pointer\';"> ... </span>';

// Show the last number in the list. (1 ... 6 7 [8] 9 10 ... >15<)
if ($start + $num_per_page * $PageContiguous < $tmpMaxPages)
$pageindex .= sprintf($base_link, $tmpMaxPages, $tmpMaxPages / $num_per_page + 1);

// Show 'Next'.
$display_page = ($start + $num_per_page) > $max_value ? $max_value : ($start + $num_per_page);
if (($display_page <= $tmpMaxPages)&&($tmpMaxPages > 1))
$pageindex .= sprintf($base_link, $display_page, '<b>Next Page &#187;</b>');

}


Note that there is one very small bug in RC3. If you are on the message index or on the unread posts/replies indexes then any threads which have more than one page will show like this:

Welcome to SMF!
Started by Simple Machines « 1 2 3 4 5 6 7 8 9 10 11 Next Page » »

This doesn't bother me since I'll just remove the pages string for the threads on those templates. I can't really see any need for it to be there since people will either want the start of the thread (click thread title) or the first new post (click "New" icon) or the last post (click last post icon hey :P). I also can't see it's worth writing another separate function to deal with it. Having the number of pages in each thread listed on those templates is just redundant markup IMO and adds nothing worth having.


ETA: I think I might package this one up as a mod.
Title: Re: <Next Page> tag on messages with multiple pages
Post by: Arantor on March 16, 2010, 09:36:05 PM
That looks like fun, only thing you'll have to change is turn the 'Previous page' and so on into proper language strings but that's not exactly a challenge.

I like it :)
Title: Re: <Next Page> tag on messages with multiple pages
Post by: Antechinus on March 17, 2010, 12:54:19 AM
No, I can't see that being a major challenge. ;D

Oh yeah, the original code in that other thread was set so that the next and previous links only showed if you weren't on the first and last pages OR on the second or second last pages. In other words, on a two or three or four page thread they didn't show at all, which kinda defeats the purpose IMO.
Title: Re: <Next Page> tag on messages with multiple pages
Post by: Antechinus on March 19, 2010, 08:34:33 AM
Funny thing happened when I tried changing the hard coded text to a proper language string. For some reason the text wont display unless it is hard coded. I tried the strings in index.english.php and in Modifications.english.php but they don't work in either. Yet as soon as the text is hard coded they work.

ETA: And yes I did define $txt as a global in the page index function so it isn't that. Not sure what is going on.
Title: Re: <Next Page> tag on messages with multiple pages
Post by: Arantor on March 19, 2010, 09:57:59 AM
1.1 or 2.0? If you did it in 2.0, clear the file cache first.

If that doesn't work, I'll be happy to look at the code and see if I can figure it out for you.
Title: Re: <Next Page> tag on messages with multiple pages
Post by: Antechinus on March 19, 2010, 05:14:30 PM
1.1.x. I tried clearing cache anyway in case it was a browser hangup. Standard procedure for code changes. ;)

I'll play with it a bit more since it was late and I may have missed something obvious.
Title: Re: <Next Page> tag on messages with multiple pages
Post by: Antechinus on March 19, 2010, 07:06:41 PM
Ok, here's another spanner to throw into the works. One of the other admins said this:

QuoteI hate the way navigation works in threads. Browsers recognize so-called navigation links, which are located in the header tag, e.g.:
<link rel="next" href="http://www.councilofexmuslims.com/index.php?topic=4620.0;prev_next=next" />

When you tell the browser to "go to the next page", it will —thanks to this stupid link tag— go to the next thread and not to the next page of the current thread. Hell, that's annoying! I would like the link tags (rel="next" and rel="prev") to point to the next and previous page respectively, but when there are no pages left, the links should point to the next or previous thread.

Which makes a lot of sense for people who use that functionality of their browsers rather than manually scrolling the cursor to the link before clicking it. So, how would one re-code the relative links so they hook up to the next page in a topic rather than to the next topic?

If they don't automatically go to the next topic when the current one runs out of pages that would still be fine, but they should at least be able to cycle through pages in the current topic.
Title: Re: <Next Page> tag on messages with multiple pages
Post by: Arantor on March 19, 2010, 07:22:01 PM
You know what? This one surprised me how easy it was to fix, it isn't funny. It's already actually figured out by Display.php

index.template.php (I'm using 1.1 default here but the principle is the same for 2.0)

Code (find) Select
// If we're viewing a topic, these should be the previous and next topics, respectively.
if (!empty($context['current_topic']))
echo '
<link rel="prev" href="', $scripturl, '?topic=', $context['current_topic'], '.0;prev_next=prev" />
<link rel="next" href="', $scripturl, '?topic=', $context['current_topic'], '.0;prev_next=next" />';


Code (replace) Select
// If we're viewing a topic, these should be the previous and next topics, respectively.
if (!empty($context['current_topic']) && !empty($context['links']['prev']))
echo '
<link rel="prev" href="', $context['links']['prev'], '" />
<link rel="next" href="', $context['links']['next'], '" />';
Title: Re: <Next Page> tag on messages with multiple pages
Post by: Antechinus on March 19, 2010, 07:37:06 PM
What? ;D Coooooooooooool. I love it when it's an easy fix. This whole thing needs to be another mod methinks, as soon as I figure out what is up with the language string.

Anyway this is what works, with hard-coded text:

{
// If they didn't enter an odd value, pretend they did.
$PageContiguous = (int) ($modSettings['compactTopicPagesContiguous'] - ($modSettings['compactTopicPagesContiguous'] % 2)) / 2;

$pageindex = '';

// Show 'Prev'
if ($start >= $num_per_page)
$pageindex .= sprintf($base_link, $start - $num_per_page, '<span class="nextprev">&#171; Previous page</span>');

// Show the first page. (>1< ... 6 7 [8] 9 10 ... 15)
if ($start > $num_per_page * $PageContiguous)
$pageindex .= sprintf($base_link, 0, '1');
else
$pageindex .= '';

// Show the ... after the first page.  (1 >...< 6 7 [8] 9 10 ... 15)
if ($start > $num_per_page * ($PageContiguous + 1))
$pageindex .= '<b> ... </b>';

// Show the pages before the current one. (1 ... >6 7< [8] 9 10 ... 15)
for ($nCont = $PageContiguous; $nCont >= 1; $nCont--)
if ($start >= $num_per_page * $nCont)
{
$tmpStart = $start - $num_per_page * $nCont;
$pageindex.= sprintf($base_link, $tmpStart, $tmpStart / $num_per_page + 1);
}

// Show the current page. (1 ... 6 7 >[8]< 9 10 ... 15)
if (!$start_invalid)
$pageindex .= '[<b>' . ($start / $num_per_page + 1) . '</b>] ';
else
$pageindex .= sprintf($base_link, $start, $start / $num_per_page + 1);

// Show the pages after the current one... (1 ... 6 7 [8] >9 10< ... 15)
$tmpMaxPages = (int) (($max_value - 1) / $num_per_page) * $num_per_page;
for ($nCont = 1; $nCont <= $PageContiguous; $nCont++)
if ($start + $num_per_page * $nCont <= $tmpMaxPages)
{
$tmpStart = $start + $num_per_page * $nCont;
$pageindex .= sprintf($base_link, $tmpStart, $tmpStart / $num_per_page + 1);
}

// Show the '...' part near the end. (1 ... 6 7 [8] 9 10 >...< 15)
if ($start + $num_per_page * ($PageContiguous + 1) < $tmpMaxPages)
$pageindex .= '<b> ... </b>';

// Show the last number in the list. (1 ... 6 7 [8] 9 10 ... >15<)
if ($start + $num_per_page * $PageContiguous < $tmpMaxPages)
$pageindex .= sprintf($base_link, $tmpMaxPages, $tmpMaxPages / $num_per_page + 1);

// Show 'Next'.
$display_page = ($start + $num_per_page) > $max_value ? $max_value : ($start + $num_per_page);
if (($display_page <= $tmpMaxPages)&&($tmpMaxPages > 1))
$pageindex .= sprintf($base_link, $display_page, '<span class="nextprev">Next page &#187;</span>');

}


If I change it to this, with $txt included in globals at the start of the function and the strings defined in index.english.php then for some reason the text wont display:

{
// If they didn't enter an odd value, pretend they did.
$PageContiguous = (int) ($modSettings['compactTopicPagesContiguous'] - ($modSettings['compactTopicPagesContiguous'] % 2)) / 2;

$pageindex = '';

// Show 'Prev'
if ($start >= $num_per_page)
$pageindex .= sprintf($base_link, $start - $num_per_page, '<span class="nextprev">',$txt['pi_prev'],'</span>');

// Show the first page. (>1< ... 6 7 [8] 9 10 ... 15)
if ($start > $num_per_page * $PageContiguous)
$pageindex .= sprintf($base_link, 0, '1');
else
$pageindex .= '';

// Show the ... after the first page.  (1 >...< 6 7 [8] 9 10 ... 15)
if ($start > $num_per_page * ($PageContiguous + 1))
$pageindex .= '<b> ... </b>';

// Show the pages before the current one. (1 ... >6 7< [8] 9 10 ... 15)
for ($nCont = $PageContiguous; $nCont >= 1; $nCont--)
if ($start >= $num_per_page * $nCont)
{
$tmpStart = $start - $num_per_page * $nCont;
$pageindex.= sprintf($base_link, $tmpStart, $tmpStart / $num_per_page + 1);
}

// Show the current page. (1 ... 6 7 >[8]< 9 10 ... 15)
if (!$start_invalid)
$pageindex .= '[<b>' . ($start / $num_per_page + 1) . '</b>] ';
else
$pageindex .= sprintf($base_link, $start, $start / $num_per_page + 1);

// Show the pages after the current one... (1 ... 6 7 [8] >9 10< ... 15)
$tmpMaxPages = (int) (($max_value - 1) / $num_per_page) * $num_per_page;
for ($nCont = 1; $nCont <= $PageContiguous; $nCont++)
if ($start + $num_per_page * $nCont <= $tmpMaxPages)
{
$tmpStart = $start + $num_per_page * $nCont;
$pageindex .= sprintf($base_link, $tmpStart, $tmpStart / $num_per_page + 1);
}

// Show the '...' part near the end. (1 ... 6 7 [8] 9 10 >...< 15)
if ($start + $num_per_page * ($PageContiguous + 1) < $tmpMaxPages)
$pageindex .= '<b> ... </b>';

// Show the last number in the list. (1 ... 6 7 [8] 9 10 ... >15<)
if ($start + $num_per_page * $PageContiguous < $tmpMaxPages)
$pageindex .= sprintf($base_link, $tmpMaxPages, $tmpMaxPages / $num_per_page + 1);

// Show 'Next'.
$display_page = ($start + $num_per_page) > $max_value ? $max_value : ($start + $num_per_page);
if (($display_page <= $tmpMaxPages)&&($tmpMaxPages > 1))
$pageindex .= sprintf($base_link, $display_page, '<span class="nextprev">',$txt['pi_next'],'</span>');

}


With index.english.php being this:

$txt['pi_next'] = 'Next page &#187;';
$txt['pi_prev'] = '&#171; Previous page';
Title: Re: <Next Page> tag on messages with multiple pages
Post by: Arantor on March 19, 2010, 07:39:33 PM
And you're using English not English-UTF8 and emptied the file cache appropriately? Hmm.
Title: Re: <Next Page> tag on messages with multiple pages
Post by: Antechinus on March 19, 2010, 07:53:14 PM
Using English ISO and it's 1.1.x so there is no file cache. I cleared the browser cache anyway though.
Title: Re: <Next Page> tag on messages with multiple pages
Post by: Arantor on March 19, 2010, 07:57:26 PM
And is it just missing, or is it throwing an error too?
Title: Re: <Next Page> tag on messages with multiple pages
Post by: Antechinus on March 19, 2010, 08:03:16 PM
Just missing. No errors in the admin log.

ETA: The empty <span class="nextprev"> is echoing to the browser but of course is not visible without any content.
Title: Re: <Next Page> tag on messages with multiple pages
Post by: Arantor on March 19, 2010, 08:07:31 PM
Does it make a difference if you use $txt['previous_next_back'] and $txt['previous_next_forward'] instead of the ones you had?
Title: Re: <Next Page> tag on messages with multiple pages
Post by: Antechinus on March 19, 2010, 08:12:44 PM
No, which is odd.
Title: Re: <Next Page> tag on messages with multiple pages
Post by: Arantor on March 19, 2010, 08:14:42 PM
Had it made a difference that would be more odd.

Is that the only change you've made to constructPageIndex?
Title: Re: <Next Page> tag on messages with multiple pages
Post by: Antechinus on March 19, 2010, 08:17:39 PM
Yup. Complete function is now as follows:

// Constructs a page list.
// $pageindex = constructPageIndex($scripturl . '?board=' . $board, $_REQUEST['start'], $num_messages, $maxindex, true);
function constructPageIndex($base_url, &$start, $max_value, $num_per_page, $flexible_start = false)
{
global $modSettings, $txt;

// Save whether $start was less than 0 or not.
$start_invalid = $start < 0;

// Make sure $start is a proper variable - not less than 0.
if ($start_invalid)
$start = 0;
// Not greater than the upper bound.
elseif ($start >= $max_value)
$start = max(0, (int) $max_value - (((int) $max_value % (int) $num_per_page) == 0 ? $num_per_page : ((int) $max_value % (int) $num_per_page)));
// And it has to be a multiple of $num_per_page!
else
$start = max(0, (int) $start - ((int) $start % (int) $num_per_page));

// Wireless will need the protocol on the URL somewhere.
if (WIRELESS)
$base_url .= ';' . WIRELESS_PROTOCOL;

$base_link = '<a class="navPages" href="' . ($flexible_start ? $base_url : strtr($base_url, array('%' => '%%')) . ';start=%d') . '">%s</a> ';

// Compact pages is off or on?
if (empty($modSettings['compactTopicPagesEnable']))
{
// Show the left arrow.
$pageindex = $start == 0 ? ' ' : sprintf($base_link, $start - $num_per_page, '«');

// Show all the pages.
$display_page = 1;
for ($counter = 0; $counter < $max_value; $counter += $num_per_page)
$pageindex .= $start == $counter && !$start_invalid ? '<b>' . $display_page++ . '</b> ' : sprintf($base_link, $counter, $display_page++);

// Show the right arrow.
$display_page = ($start + $num_per_page) > $max_value ? $max_value : ($start + $num_per_page);
if ($start != $counter - $max_value && !$start_invalid)
$pageindex .= $display_page > $counter - $num_per_page ? ' ' : sprintf($base_link, $display_page, '»');
}
else
{
// If they didn't enter an odd value, pretend they did.
$PageContiguous = (int) ($modSettings['compactTopicPagesContiguous'] - ($modSettings['compactTopicPagesContiguous'] % 2)) / 2;

$pageindex = '';

// Show 'Prev'
if ($start >= $num_per_page)
$pageindex .= sprintf($base_link, $start - $num_per_page, '<span class="nextprev">', $txt['pi_prev'],'</span>');

// Show the first page. (>1< ... 6 7 [8] 9 10 ... 15)
if ($start > $num_per_page * $PageContiguous)
$pageindex .= sprintf($base_link, 0, '1');
else
$pageindex .= '';

// Show the ... after the first page.  (1 >...< 6 7 [8] 9 10 ... 15)
if ($start > $num_per_page * ($PageContiguous + 1))
$pageindex .= '<b> ... </b>';

// Show the pages before the current one. (1 ... >6 7< [8] 9 10 ... 15)
for ($nCont = $PageContiguous; $nCont >= 1; $nCont--)
if ($start >= $num_per_page * $nCont)
{
$tmpStart = $start - $num_per_page * $nCont;
$pageindex.= sprintf($base_link, $tmpStart, $tmpStart / $num_per_page + 1);
}

// Show the current page. (1 ... 6 7 >[8]< 9 10 ... 15)
if (!$start_invalid)
$pageindex .= '[<b>' . ($start / $num_per_page + 1) . '</b>] ';
else
$pageindex .= sprintf($base_link, $start, $start / $num_per_page + 1);

// Show the pages after the current one... (1 ... 6 7 [8] >9 10< ... 15)
$tmpMaxPages = (int) (($max_value - 1) / $num_per_page) * $num_per_page;
for ($nCont = 1; $nCont <= $PageContiguous; $nCont++)
if ($start + $num_per_page * $nCont <= $tmpMaxPages)
{
$tmpStart = $start + $num_per_page * $nCont;
$pageindex .= sprintf($base_link, $tmpStart, $tmpStart / $num_per_page + 1);
}

// Show the '...' part near the end. (1 ... 6 7 [8] 9 10 >...< 15)
if ($start + $num_per_page * ($PageContiguous + 1) < $tmpMaxPages)
$pageindex .= '<b> ... </b>';

// Show the last number in the list. (1 ... 6 7 [8] 9 10 ... >15<)
if ($start + $num_per_page * $PageContiguous < $tmpMaxPages)
$pageindex .= sprintf($base_link, $tmpMaxPages, $tmpMaxPages / $num_per_page + 1);

// Show 'Next'.
$display_page = ($start + $num_per_page) > $max_value ? $max_value : ($start + $num_per_page);
if (($display_page <= $tmpMaxPages)&&($tmpMaxPages > 1))
$pageindex .= sprintf($base_link, $display_page, '<span class="nextprev">',$txt['pi_next'],'</span>');

}

return $pageindex;
}
Title: Re: <Next Page> tag on messages with multiple pages
Post by: Arantor on March 19, 2010, 08:20:51 PM
I see absolutely no reason why that shouldn't work. At that point the language files should be loaded :S
Title: Re: <Next Page> tag on messages with multiple pages
Post by: Antechinus on March 19, 2010, 08:26:53 PM
rofl. Finally got it. Wrong syntax. Instead of  ' , $txt['pi_prev'] , '  it has to be ' . $txt['pi_prev'] . '

That works. ;D
Title: Re: <Next Page> tag on messages with multiple pages
Post by: Antechinus on March 19, 2010, 08:28:34 PM
Ok I think this while thing is solved now. All it needs is a nice little xml file or two.
Title: Re: <Next Page> tag on messages with multiple pages
Post by: Arantor on March 19, 2010, 08:32:20 PM
AH, that makes sense. Subtle one that.

Good to know it's sorted.
Title: Re: <Next Page> tag on messages with multiple pages
Post by: Antechinus on March 19, 2010, 08:34:52 PM
Thanks for your help. I'll zip the thing up and blow up my test site. ;)
Title: Re: <Next Page> tag on messages with multiple pages
Post by: Antechinus on March 21, 2010, 08:29:32 AM
Hey got an improvement for that code for the relative links up in head. When there was no previous page, only a next page, no link tag was inserted at all into the header tag. This sorts it out really well:

  if (!empty($context['links']['next']))
    echo '<link rel="next" href="', $context['links']['next'], '" />';
  else if (!empty($context['current_topic']))
    echo '<link rel="next" href="', $scripturl, '?topic=', $context['current_topic'], '.0;prev_next=next" />';
  if (!empty($context['links']['prev']))
    echo '<link rel="prev" href="', $context['links']['prev'], '" />';
  else if (!empty($context['current_topic']))
    echo '<link rel="prev" href="', $scripturl, '?topic=', $context['current_topic'], '.0;prev_next=prev" />';


That covers all bases. It will go to the next or previous page even if one of those is missing, and it will also take you to the next or previous topics when you run out of pages in the current topic. Best of both worlds.  :)
Title: Re: <Next Page> tag on messages with multiple pages
Post by: Arantor on March 21, 2010, 08:30:15 AM
Awesome :)

Yeah, I didn't think about that case.
Title: Re: <Next Page> tag on messages with multiple pages
Post by: spritzer on August 13, 2010, 07:57:26 AM
Antechinus did you get any further with this (did it work on your test site)?

I've just converted our large forum over from phpbb, and the only complaint so far is the inability to goto next/previous page, so wouldn't mind giving it a go.

Title: Re: <Next Page> tag on messages with multiple pages
Post by: Antechinus on August 13, 2010, 07:46:30 PM
I never made it into a mod (been too busy with other things) but the code works perfectly.
Title: Re: <Next Page> tag on messages with multiple pages
Post by: spritzer on August 14, 2010, 02:10:30 PM
Okay, might just give it a go.

Thanks