PDA

View Full Version : Make this show the whole topic. Possible ?



demii
30 Aug 2010, 11:32 AM
Can i make this code to show more than just the forum title ? i want to see the whole topic, i wanna use this for my forum news and link it to my index page so when i make a new thread in the "news" on my forum then it gets linked to the website as a "news"


<?php
// How Many Topics you want to display?
$topicnumber = 5;
// Change this to your phpBB path
$urlPath = "/forum";

// Database Configuration (Where your phpBB config.php file is located)
include 'config.php';

$table_topics = $table_prefix. "topics";
$table_forums = $table_prefix. "forums";
$table_posts = $table_prefix. "posts";
$table_users = $table_prefix. "users";
$link = mysql_connect("$dbhost", "$dbuser", "$dbpasswd") or die("Could not connect");
mysql_select_db("$dbname") or die("Could not select database");

$query = "SELECT t.topic_id, t.topic_title, t.topic_last_post_id, t.forum_id, p.post_id, p.poster_id, p.post_time, u.user_id, u.username
FROM $table_topics t, $table_forums f, $table_posts p, $table_users u
WHERE t.topic_id = p.topic_id AND
f.forum_id = t.forum_id AND
t.forum_id != 3 AND
t.forum_id != 5 AND
t.forum_id != 7 AND
t.forum_id != 7 AND
t.forum_id != 8 AND
t.forum_id != 9 AND
t.forum_id != 11 AND
t.forum_id != 12 AND
t.forum_id != 13 AND
t.forum_id != 14 AND
t.forum_id != 16 AND
t.forum_id != 18 AND
t.forum_id != 20 AND
t.forum_id != 21 AND
t.forum_id != 22 AND
t.forum_id != 23 AND
t.forum_id != 26 AND
t.forum_id != 27 AND
t.forum_id != 28 AND
t.forum_id != 29 AND
t.forum_id != 30 AND
t.forum_id != 31 AND
t.forum_id != 34 AND
t.forum_id != 35 AND
t.forum_id != 17 AND
t.forum_id != 38 AND
t.forum_id != 40 AND
t.forum_id != 39 AND
t.forum_id != 37 AND
t.forum_id != 36 AND
t.forum_id != 41 AND
t.forum_id != 43 AND
t.forum_id != 44 AND
t.forum_id != 45 AND
t.forum_id != 46 AND
t.forum_id != 53 AND
t.forum_id != 49 AND
t.forum_id != 50 AND
t.forum_id != 51 AND
t.forum_id != 52 AND
t.forum_id != 55 AND
t.forum_id != 56 AND
t.forum_id != 57 AND
t.forum_id != 47 AND
t.forum_id != 60 AND
t.topic_status <> 2 AND
p.post_id = t.topic_last_post_id AND
p.poster_id = u.user_id
ORDER BY p.post_id DESC LIMIT $topicnumber";
$result = mysql_query($query) or die("Query failed");

print "<table cellpadding='0' cellSpacing='0' height='100%' width='100%'>";
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {

echo "<tr valign='top'><td><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><font color=\"#CCC\"><b><h1><a href=\"$urlPath/viewtopic.php?f=$row[forum_id]&t=$row[topic_id]&p=$row[post_id]#p$row[post_id]\">" .
$row["topic_title"] .
"</td><tr valign='under'></font></b><td><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><font color=\"#C0C0C0\"> Av: <a href=\"$urlPath/memberlist.php?mode=viewprofile&u=$row[user_id]\">" .
$row["username"] .
"<tr valign='baseline'></td><td><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><font color=\"#C0C0C0\">" .
date('d M, H:i', $row["post_time"]) .
"</td></tr></font>";
}
print "</table>";
mysql_free_result($result);
mysql_close($link);
?>

Else i wanna know how to make a RSS that does what i want to do.