PHPBB most poupular topics on homepage

Discussion in 'PHP' started by tomred, Apr 30, 2007.

  1. #1
    Hiya,

    I have a site with a PHPBB board, I want to put the 10 most popular posts on my site homepage, anybody got a link or piece of script that will let me do this?

    Thanks,

    Tomred
     
    tomred, Apr 30, 2007 IP
  2. SoKickIt

    SoKickIt Active Member

    Messages:
    305
    Likes Received:
    30
    Best Answers:
    0
    Trophy Points:
    70
    #2
    How would you define "10 most popular posts"?


    Edit: It says "topics" in the title so I guess this could work:


    
    $result = mysql_query("SELECT topic_id, topic_title FROM phpbb_topics ORDER BY topic_replies DESC LIMIT 10");
    			
    echo '<ul>';
    			
    while($row = mysql_fetch_array($result))
    {
    	echo '<li>';
    	echo '<a href="/phpBB/viewtopic.php?t=' . $row['topic_id'] . '">' . $row['topic_title'] . '</a>';
    	echo '</li>';
    }
    
    echo '</ul>';
    
    PHP:
     
    SoKickIt, Apr 30, 2007 IP
  3. tomred

    tomred Peon

    Messages:
    382
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #3
    That's exactly what I'm talking about!

    I dont know much about PHP though, if I just paste that into my index.php will it work?
     
    tomred, Apr 30, 2007 IP
  4. SoKickIt

    SoKickIt Active Member

    Messages:
    305
    Likes Received:
    30
    Best Answers:
    0
    Trophy Points:
    70
    #4
    It should work. Just check if your "phpbb table prefix" is really "phpbb_". If not, replace "phpbb_" in "phpbb_topics" with the prefix you used. You should also replace "phpBB" with the board folder name in case it's not "phpBB".
     
    SoKickIt, Apr 30, 2007 IP