Recent.php - Forum text anzeigen lassen
Verfasst: 08.08.2005 22:48
Guten Abend
Ich hab mich jetzt ein wenig an phpbb ran gesetzt und mir nen Forum Gemacht. Jetzt wollte ich auf meiner Homepage immer die News zeigen lassen die ich ins Forum schreibe. Ich habe dafür den Recent Mod genutzt.
Es läuft zwar bestens aber der PHP Code gibt nur das aus:
Titel
Forum: Name Datum
Jetzt meine Frage kann ich das so einstellen das zwichen Titel und Forum: Name Datum der Text angezeigt wird?
Also:
Titel
Text Bla Bla bla usw...
Forum: Name Datum
Und am Ende noch eine leere Zeile, damit diese nicht nachher so aneinander kleben
Ich kann ja hier mal den Code schicken und ich hoffe ihr könnt mir dabei helfen.
Jetzt schon mal Danke
Ich hab mich jetzt ein wenig an phpbb ran gesetzt und mir nen Forum Gemacht. Jetzt wollte ich auf meiner Homepage immer die News zeigen lassen die ich ins Forum schreibe. Ich habe dafür den Recent Mod genutzt.
Es läuft zwar bestens aber der PHP Code gibt nur das aus:
Titel
Forum: Name Datum
Jetzt meine Frage kann ich das so einstellen das zwichen Titel und Forum: Name Datum der Text angezeigt wird?
Also:
Titel
Text Bla Bla bla usw...
Forum: Name Datum
Und am Ende noch eine leere Zeile, damit diese nicht nachher so aneinander kleben
Ich kann ja hier mal den Code schicken und ich hoffe ihr könnt mir dabei helfen.
Jetzt schon mal Danke
// ############## output ##############
echo '<table width="100%" cellpadding="1" cellspacing="1" border="0" align="center">
</tr>';
// ############## output ##############
$where_forums = ( $special_forums == '0' ) ? '' : 't.forum_id IN ('. $forum_ids .') AND ';
$sql = "SELECT t.*, f.forum_id, f.forum_name, u.username AS first_poster, u.user_id AS first_poster_id, u2.username AS last_poster, u2.user_id AS last_poster_id, p.post_username AS first_poster_name, p2.post_username AS last_poster_name, p2.post_time
FROM ". $table_prefix ."topics t, ". $table_prefix ."forums f, ". $table_prefix ."users u, ". $table_prefix ."posts p, ". $table_prefix ."posts p2, ". $table_prefix ."users u2
WHERE $where_forums t.topic_poster = u.user_id AND f.forum_id = t.forum_id AND p.post_id = t.topic_first_post_id AND p2.post_id = t.topic_last_post_id AND u2.user_id = p2.poster_id
ORDER BY t.topic_last_post_id DESC LIMIT $topic_limit";
$result = mysql_query($sql);
if( !$result )
{
die('SQL Statement Error: '. mysql_error());
exit();
}
$line = array();
while( $row = mysql_fetch_array($result) )
{
$line[] = $row;
}
for( $i = 0; $i < count($line); $i++ )
{
$forum_id = $line[$i]['forum_id'];
$forum_url = $root_path .'viewforum.php?f='. $forum_id;
$topic_id = $line[$i]['topic_id'];
$topic_url = $root_path .'viewtopic.php?t='. $topic_id;
$topic_title = ( strlen($line[$i]['topic_title']) < $topic_length ) ? $line[$i]['topic_title'] : substr(stripslashes($line[$i]['topic_title']), 0, $topic_length) .'...';
$topic_type = ( $line[$i]['topic_type'] == '2' ) ? 'Announcement ': '';
$topic_type .= ( $line[$i]['topic_type'] == '3' ) ? 'Global Announcement ': '';
$topic_type .= ( $line[$i]['topic_type'] == '1' ) ? 'Sticky ': '';
$topic_type .= ( $line[$i]['topic_vote'] ) ? 'Poll ': '';
$views = $line[$i]['topic_views'];
$replies = $line[$i]['topic_replies'];
$first_time = date('d.m.Y', $line[$i]['topic_time']);
$first_author = ( $line[$i]['first_poster_id'] != '-1' ) ? '<a href="'. $root_path .'profile.php?mode=viewprofile&u='. $line[$i]['first_poster_id'] .'">'. $line[$i]['first_poster'] .'</a>' : ( ($line[$i]['first_poster_name'] != '' ) ? $line[$i]['first_poster_name'] : 'guest' );
$last_time = date('d.m.Y', $line[$i]['post_time']);
$last_author = ( $line[$i]['last_poster_id'] != '-1' ) ? $line[$i]['last_poster'] : ( ($line[$i]['last_poster_name'] != '' ) ? $line[$i]['last_poster_name'] : 'guest' );
$last_url = '<a href="'. $root_path .'viewtopic.php?p='. $line[$i]['topic_last_post_id'] .'#'. $line[$i]['topic_last_post_id'] .'">'. $last_author .'</a>';
// ############## output ##############
echo '<tr>
<td valign="top" nowrap="nowrap">'. $topic_type .'<a href="'. $topic_url .'"target="_blank">'. $topic_title .'</a></td>
</tr>
<tr>
<td><a href="'. $forum_url .'"target="_blank">'. $line[$i]['forum_name'] .'</a>: '. $last_author .' '. $last_time .'</td><br />
</tr>';
// ############## output ##############