Topic: Pages thing,

I know i've asked for this before but i'm not sure if i was just on irc so i wanted to ask again tongue,

Basically when you have a topic, say you have 15 posts per page, the 16th post (and maybe 17th too) should "stick" to the end of the first page if there are no posts after it, once there are posts after them they should move to the next page. I think this would allow conversations to move much more smoothly.

2 (edited by Tobi 2005-10-18 17:23)

Re: Pages thing,

This should do the trick for you.
Not tested too heavily as usual wink (but works on the only board I have that has threads of that size...) , and since it is an extra request it might have a slight impact on the speed
Go to viewtopic.php and find around line 123:

    if ($is_admmod)
        $post_link .= ' / <a href="post.php?tid='.$id.'">'.$lang_topic['Post reply'].'</a>';
}

After this, add

//Determine the total number of posts in this topic
$result = $db->query('SELECT count(*) as CT  FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id INNER JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id LEFT JOIN '.$db->prefix.'online AS o ON (o.user_id=u.id AND o.user_id!=1 AND o.idle=0) WHERE p.topic_id='.$id) or error('Unable to fetch post count', __FILE__, __LINE__, $db->error());
$cur_post = $db->fetch_assoc($result);
if($cur_post['CT'] <= ($pun_user['disp_posts'] + 2)) $pun_user['disp_posts'] = $cur_post['CT'];

Now, if you also want to get rid of the post counts in viewforum.php, then go to line 264 (ca.)

Replace this

$num_pages_topic = ceil(($cur_topic['num_replies'] + 1) / $pun_user['disp_posts']);

with this

    if(($cur_topic['num_replies'] + 1) <= ($pun_user['disp_posts'] + 2))  $num_pages_topic = 1;
    else    $num_pages_topic = ceil(($cur_topic['num_replies'] + 1) / $pun_user['disp_posts']);
The German PunBB Site:
PunBB-forum.de

Re: Pages thing,

isn't $cur_topic['num_replies'] + 1 the same as $cur_post['CT'] ?

4 (edited by Tobi 2005-10-18 20:44)

Re: Pages thing,

Yes. You could use num_replies for that as well. Of course with another kind of query.
But it wouldn't look half as important smile

The German PunBB Site:
PunBB-forum.de

Re: Pages thing,

no, i don't think you understand, $cur_topic['num_replies'] is already set so there is no need to run your extra query smile

6

Re: Pages thing,

Yes. Right. I did not see that one.
Ok, so we combine my wisdom with yours and we have the solution, right? smile

The German PunBB Site:
PunBB-forum.de

Re: Pages thing,

yes, but i was not looking for a solution, i was looking for rickard to add it to the code tongue

8

Re: Pages thing,

Your post did not mention only Rickard being addressed so I thought I spend a minute to help out.
Anyway, if he decides not to add it to the code I'm sure you can still do it yourself tongue

The German PunBB Site:
PunBB-forum.de

Re: Pages thing,

Yeh i'm not complaining, but i can do it, i am not asking for it because i want it for my site i am sugggesting it should be a feature.

Re: Pages thing,

And it is in the feature request forum smile

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: Pages thing,

Although most of the feature requests are really mod requests tongue

12

Re: Pages thing,

..and that's why I thought this was one as well....

The German PunBB Site:
PunBB-forum.de