This is probably extremely fugly, but it is a good base to start on. I have not seen forum topic pagination on any Drupal based forum, but it is very common (essential?) on standalone forums.
In forum-topic-list.tpl.php on around line 44, replace <td class="title"><?php print $topic->title; ?></td> with:
<td class="title"><?php print $topic->title; ?>
<?php
$comments_per_page = _comment_get_display_setting('comments_per_page', $topic->nid);
if ($topic->num_comments > $comments_per_page) {
print '<div class="description">[Page:';
print '<a href="'. base_path() .'node/'. $topic->nid .'"> 1</a>';
print ', <a href="'. base_path() .'node/'. $topic->nid .'?page=1">2</a>';
if ($topic->num_comments > $comments_per_page * 2) {
print ', <a href="'. base_path() .'node/'. $topic->nid .'?page=2">3</a>';
if ($topic->num_comments > $comments_per_page * 3) {
if ($topic->num_comments <= $comments_per_page * 4) {
print ', <a href="'. base_path() .'node/'. $topic->nid .'?page=3">4</a>';
}
else {
$lastpage = floor($topic->num_comments / $comments_per_page);
print ' &hellip <a href="'. base_path() .'node/'. $topic->nid .'?page='. $lastpage .'">last</a>';
}
}
}
print ']</div>';
}
?>
</td>
You can see the full effect at http://www.therevival.co.uk/forum
Notice that all topics with more than one page have the pages listed under the title. Upto 3 or 4 pages. If there are more, there is a link to the last page.
Comments? Anyone willing to clean it up? move it to its right place? (which I suppose is the template_preprocess_forum_topic_list function... but that probably takes more effort to do properly.)
Comments
Comment #1
naheemsays commentedheh, already ran into a problem. :P
For some reason it is not calculating the correct number of pages (or maybe the comments per page is wrong?)
It was working fine on my test set up so no ides why it is broken now.
EDIT - I just hard coded the value for comments per page to 30 (which is what I have and it is working... for some reason the code reads it as 50. No pages on the site have 50 comments per page. :/
Comment #2
michelleThis is something I was planning on doing, but I have some bugs I need to clean up so I can release a pair of alphas first. You're right, though, that the code belongs in the preprocess, not the .tpl. I'll have a look once I get the alphas out. That's the priority for me since there have been a lot of changes since the last alpha but the devs aren't yet usable so the module is in a bad state for users.
Michelle
Comment #3
michelleWell, I know I said I was going to wait but it was more interesting than bug fixing. ;) I didn't use your actual code other than a few bits here and there, but my version is committed. Will be in the dev tarballs in about 45 minutes.
Michelle
Comment #4
michelleOh, PS: Putting on every page is an oversight, not a design change. Will fix soon as I can.
Michelle
Comment #5
michelleOk, fix committed. That was a lot harder than I thought. Took several hours to get that thing working right. LOL
Michelle
Comment #6
naheemsays commentedJust downloaded this module to test.
Is it possible to place the paging in its own div instead of just a linebreak? that would make it easier to theme. without having to edit the tpl file.
Comment #7
michelleDone. :)
Michelle
Comment #8
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.