Seite 1 von 1
Letzten 5 Tehmen
Verfasst: 02.01.2010 18:39
von alex2009
Hallo
Ist es möklich unter dem banner eine anzeige zu machen mit den letzten 5 Post aus der foren kategorie 55?
Und wenn ich dan einen der 5 links anklicke das ich dan zu dem thema kommen
aber:
das die sachen automatisch dort eingefügt werden also nicht das ich die immer manuell einfügen muss in die box
mfg
alex2009
Re: Letzten 5 Tehmen
Verfasst: 02.01.2010 19:10
von Metzle
Hallo,
schau dir mal die Mod
NV recent topics an. Die könnte eventuell etwas für dich sein.
Re: Letzten 5 Tehmen
Verfasst: 02.01.2010 19:40
von alex2009
erlich gesagt ist mir das zuviel
also ich möchte einfach 1datei auf meinem webspace also im phpbb3 ordner wo ich dan halt alles einstelle
und dan diese datei untermeinem hedder einbinden
ist das schwer zu machen?
Re: Letzten 5 Tehmen
Verfasst: 02.01.2010 20:15
von Metzle
Hallo,
es wird nicht sehr viel weniger sein, meiner Meinung nach.
Re: Letzten 5 Tehmen
Verfasst: 02.01.2010 20:16
von 4seven
Re: Letzten 5 Tehmen
Verfasst: 02.01.2010 21:58
von alex2009
also das letzte ist sehr gut aber
es funktioniert nicht so wirklich:
Code: Alles auswählen
<?php
// ############ Edit below ########################################
$topic_length = '50'; // length of topic title
$topic_limit = '5'; // limit of displayed topics
$special_forums = '0'; // specify forums ('0' = no; '1' = yes)
$forum_ids = '55'; // IDs of forums; separate them with a comma
$config_path = '/'; // path to config.php
$root_path = 'http://www.forum.landwirtschafts-simulator.info/'; // link path
$path = dirname(__FILE__);
include_once($path.$config_path .'config.php');
mysql_connect($dbhost, $dbuser, $dbpasswd) OR die('Unable to select server.');
mysql_select_db($dbname) OR die('Unable to select database.');
// ############## output ##############
echo '<table border="0" cellpadding="0" cellspacing="0" style="width: 100%" id="Table_DSF-Top5">
<body text="#000000" link="#000000" vlink="#333333" alink="#333333">
<tr>
<td colspan="4"><span class="small"><font face="Verdana, Arial, Helvetica, sans-serif" style="font-size:11px">
Die '. $topic_limit .' letzten Themen im Forum</font></span></td><br>
</tr>
<tr>
<td style="width: 20%"><span class="small"><strong>
<font face="Verdana, Arial, Helvetica, sans-serif" style="font-size:11px">Thema</font>
</strong>
<font face="Verdana, Arial, Helvetica, sans-serif" style="font-size:9px"></font
</strong></span></td>
</tr>';
// ############## output ##############
$where_forums = ( $special_forums == '0' ) ? '' : 't.forum_id NOT 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'] .'" target="_blank">'. $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'] .'" target="_blank">'. $last_author .'</a>';
// ############## output ##############
echo '<tr>
<td style="width: 20%"><a href="'. $topic_url .'" target="_blank">
<font face="Verdana, Arial, Helvetica, sans-serif" style="font-size:11px">'. $topic_title .'</font></a></td>
</tr>';
// ############## output ##############
}
echo '</table>';
mysql_close();
?>
Ich habe bei
halt 55 stehen aber er zeigt die letzten 5 themen aus dem ganzen forum an
Re: Letzten 5 Tehmen
Verfasst: 02.01.2010 22:03
von 4seven
ändere
Code: Alles auswählen
$special_forums = '0'; // specify forums ('0' = no; '1' = yes)
in
Code: Alles auswählen
$special_forums = '1'; // specify forums ('0' = no; '1' = yes)
tip: nimm "saschas optimierten code" oder andere spätere versionen...