Hi,
Thanks for your time with this. I really appreciate it!
Happy holidays if it's the case!
I've already tried something like that but it only displays the 1st post of the topic not parsing the rest.
With original viewtopic.php, showing 3 posts:
Debug information
Time (s) Query
0.00131 SELECT u.*, g.*, o.logged, o.idle FROM users AS u INNER JOIN groups AS g ON u.group_id=g.g_id LEFT JOIN online AS o ON o.user_id=u.id WHERE u.id=3
0.00014 UPDATE online SET logged=1166722642 WHERE user_id=3
0.00011 UPDATE online SET current_page='/punbb_standard/viewtopic.php', current_ip='213.22.18.126', current_page_id='7' WHERE user_id='3'
0.00015 SELECT * FROM online WHERE logged<1166722342
0.00083 SELECT t.subject, t.closed, t.num_replies, t.sticky, f.id AS forum_id, f.forum_name, f.moderators, fp.post_replies, s.user_id AS is_subscribed FROM topics AS t INNER JOIN forums AS f ON f.id=t.forum_id LEFT JOIN subscriptions AS s ON (t.id=s.topic_id AND s.user_id=3) LEFT JOIN forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=4) WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id=7 AND t.moved_to IS NULL
0.00022 SELECT search_for, replace_with FROM censoring
0.00088 SELECT u.email, u.title, u.url, u.location, u.use_avatar, u.signature, u.email_setting, u.num_posts, u.registered, u.admin_note, p.id, p.poster AS username, p.poster_id, p.poster_ip, p.poster_email, p.message, p.hide_smilies, p.posted, p.edited, p.edited_by, g.g_id, g.g_user_title, o.user_id AS is_online FROM posts AS p INNER JOIN users AS u ON u.id=p.poster_id INNER JOIN groups AS g ON g.g_id=u.group_id LEFT JOIN online AS o ON (o.user_id=u.id AND o.user_id!=1 AND o.idle=0) WHERE p.topic_id=7 ORDER BY p.id LIMIT 0,25
0.00028 UPDATE LOW_PRIORITY topics SET num_views=num_views+1 WHERE id=7
Total query time: 0.00392 s
This is viewtopic.php with the above code and with the result of only showing the first post of a topic:
Debug information
Time (s) Query
0.00112 SELECT u.*, g.*, o.logged, o.idle FROM users AS u INNER JOIN groups AS g ON u.group_id=g.g_id LEFT JOIN online AS o ON o.user_id=u.id WHERE u.id=3
0.00012 UPDATE online SET logged=1166722500 WHERE user_id=3
0.00010 UPDATE online SET current_page='/punbb_standard/viewtopic.php', current_ip='213.22.18.126', current_page_id='7' WHERE user_id='3'
0.00013 SELECT * FROM online WHERE logged<1166722200
0.00081 SELECT t.subject, t.closed, t.num_replies, t.sticky, f.id AS forum_id, f.forum_name, f.moderators, fp.post_replies, s.user_id AS is_subscribed FROM topics AS t INNER JOIN forums AS f ON f.id=t.forum_id LEFT JOIN subscriptions AS s ON (t.id=s.topic_id AND s.user_id=3) LEFT JOIN forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=4) WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id=7 AND t.moved_to IS NULL
0.00024 SELECT search_for, replace_with FROM censoring
0.00074 SELECT u.email, u.title, u.url, u.location, u.use_avatar, u.signature, u.email_setting, u.num_posts, u.registered, u.admin_note, p.id, p.poster AS username, p.poster_id, p.poster_ip, p.poster_email, p.message, p.hide_smilies, p.posted, p.edited, p.edited_by, g.g_id, g.g_user_title, o.user_id AS is_online FROM posts AS p INNER JOIN users AS u ON u.id=p.poster_id INNER JOIN groups AS g ON g.g_id=u.group_id LEFT JOIN online AS o ON (o.user_id=u.id AND o.user_id!=1 AND o.idle=0) WHERE p.topic_id=7 ORDER BY p.id LIMIT 0,25
0.00036 SELECT DISTINCT reported_by FROM reports WHERE post_id = 8 AND zapped IS NULL
0.00022 UPDATE LOW_PRIORITY topics SET num_views=num_views+1 WHERE id=7
Total query time: 0.00384 s
As I can see it, the sugested code breaks this loop:
while ($cur_post = $db->fetch_assoc($result))
{
$post_count++;
$user_avatar = '';
$user_info = array();
$user_contacts = array();
$post_actions = array();
$is_online = '';
$signature = '';
By adding one variable that isn't reset.
But I don't have any experience or whatever with PHP or programming. I'm just a curious.
Thanks in advance.