1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

phpbb biggest (perhaps) drawback solved

Discussion in 'phpBB' started by king_cobra, Sep 21, 2005.

  1. #1
    Hi all,

    I was working with phppb for some two days now. and as u can see from my previous posts i was constantly bugging people for tips. anyway, as necessity is the mother of invention, i found a way out of the biggest draw back (for me, atleast) of phpbb. that is not showing the last post topic title in the forum index page. So let me share the mod with all those who want the last post topic title to be shown in forum index.

    Find in forum_root_folder/index.php

    default:
    	$sql = "SELECT f.*, t.topic_id, t.topic_title, p.post_time, p.post_username, u.username, u.user_id
    		FROM (( " . FORUMS_TABLE . " f
    		LEFT JOIN " . POSTS_TABLE . " p ON p.post_id = f.forum_last_post_id )
    		LEFT JOIN " . USERS_TABLE . " u ON u.user_id = p.poster_id )
    		ORDER BY f.cat_id, f.forum_order";
    		break;
    PHP:
    Replace with
    SEMrush
    default:
    	$sql = "SELECT f.*, t.topic_id, t.topic_title, p.post_time, p.post_username, u.username, u.user_id
    		FROM ((( " . FORUMS_TABLE . " f
    		LEFT JOIN " . POSTS_TABLE . " p ON p.post_id = f.forum_last_post_id )
    		LEFT JOIN " . USERS_TABLE . " u ON u.user_id = p.poster_id )
    		LEFT JOIN " . TOPICS_TABLE. " t ON t.topic_id = p.topic_id)
    		ORDER BY f.cat_id, f.forum_order";
    		break;
    PHP:
    Find

    if ( $forum_data[$j]['forum_last_post_id'] )
    {
    	$last_post_time = create_date($board_config['default_dateformat'], $forum_data[$j]['post_time'], $board_config['board_timezone']);
    
    	$last_post = $last_post_time . '<br />';
    
    	$last_post .= ( $forum_data[$j]['user_id'] == ANONYMOUS ) ? ( ($forum_data[$j]['post_username'] != '' ) ? $forum_data[$j]['post_username'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . '='  . $forum_data[$j]['user_id']) . '">' . $forum_data[$j]['username'] . '</a> ';
    	
    	$last_post .= '<a href="' . append_sid("viewtopic.$phpEx?"  . POST_POST_URL . '=' . $forum_data[$j]['forum_last_post_id']) . '#' . $forum_data[$j]['forum_last_post_id'] . '"><img src="' . $images['icon_latest_reply'] . '" border="0" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" /></a>';
    }
    PHP:
    Replace with

    if ( $forum_data[$j]['forum_last_post_id'] )
    {
    	$last_post_time = create_date($board_config['default_dateformat'], $forum_data[$j]['post_time'], $board_config['board_timezone']);
    	
    	$last_post = '<a href="' . append_sid("viewtopic.$phpEx?"  . POST_TOPIC_URL . '=' . $forum_data[$j]['topic_id']) . '#' . $forum_data[$j]['forum_last_post_id'] . '" title="' . $forum_data[$j]['topic_title'] . '">' .$forum_data[$j]['topic_title']. '</a>' . '<br /> by ';
    
    	$last_post .= ( $forum_data[$j]['user_id'] == ANONYMOUS ) ? ( ($forum_data[$j]['post_username'] != '' ) ? $forum_data[$j]['post_username'] . ' ' : $lang['Guest'] . ' ' ) : $forum_data[$j]['username'];
    	
    	$last_post .= '<br />'. $last_post_time;
    }
    PHP:
    there is no need to edit the template file.

    Hope you enjoy it. You are free to use this, share this, but if you prefer to give someone a link to the mod, please give the link to this thread.

    Thankyou.
    Any doubt, just post here.
     
    king_cobra, Sep 21, 2005 IP
    SEMrush
  2. yfs1

    yfs1 User Title Not Found

    Messages:
    13,799
    Likes Received:
    922
    Best Answers:
    0
    Trophy Points:
    0
    #2
    yfs1, Sep 21, 2005 IP
  3. king_cobra

    king_cobra Peon

    Messages:
    373
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I had tested that one, but it uses a seperate sql query to fetch the title. why have a seperate query done when it can be done in the same query set?
     
    king_cobra, Sep 21, 2005 IP
  4. RectangleMan

    RectangleMan Notable Member

    Messages:
    2,825
    Likes Received:
    131
    Best Answers:
    0
    Trophy Points:
    210
    #4
    RectangleMan, Sep 21, 2005 IP
  5. king_cobra

    king_cobra Peon

    Messages:
    373
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #5
    cool idea labrocca. thaks for it.
     
    king_cobra, Sep 22, 2005 IP