Seite 1 von 1

Letzter Beitrag im Forum auf externer Seite

Verfasst: 01.09.2005 15:27
von clauDius
Moin,
habe im Forum nichts passendes gefunden. Ich suche einen MOD, der bewirkt, dass auf einer externen Seite der letzte Beitrag im Forum ausgegeben wird, quasi so:

Neues Forum
Seit heute haben wir ein neues Forum, es i.... mehr?! Klick

Wenn man dann auf mehr klickt kommt man zu dem Thread, kann natürlich auch anders funktionieren. Also ich möchte nicht das letzte neu erstellte Thema, sondern den zuletzt erstellten Beitrag!

Gibts da schon was, was ich nicht gefunden habe?

Verfasst: 01.09.2005 15:30
von Markus67
Hi ...

da dürfte dieser MOD was für dich sein :wink:
[2.0.x] Anzeige der letzten Themen

Markus

Verfasst: 01.09.2005 15:38
von clauDius
Hi,
den hatte ich schon, sieht nur ein bisschen träge aus:
http://www.chathalle.de/recent.php

Keine Beitragsvorschau :(/

Verfasst: 01.09.2005 16:15
von clauDius
So, habe mich ein bisschen dran gesetzt, jetzt sieht es so aus:

Code: Alles auswählen

<?php
// ############         Edit below         ########################################
$topic_length = '30';	// length of topic title
$topic_limit = '1';	// limit of displayed topics
$special_forums = '0';	// specify forums ('0' = no; '1' = yes)
$forum_ids = '';		// IDs of forums; separate them with a comma

$config_path = '/forum/';	// path to config.php
$root_path = '/forum/';		// link path
// ############         Edit above         ########################################

$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 width="100%" cellpadding="1" cellspacing="1" border="0" align="center">
          <tr>
                <th colspan="2">Letzter Beitrag:</th>
          </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' ) ? 'Ankündigung:': '';
	$topic_type .= ( $line[$i]['topic_type'] == '3' ) ? 'Ankündigung:': '';
	$topic_type .= ( $line[$i]['topic_type'] == '1' ) ? 'Wichtig:': '';
	$topic_type .= ( $line[$i]['topic_vote'] ) ? 'Umfrage:': '';

	$views = $line[$i]['topic_views'];
	$replies = $line[$i]['topic_replies'];

	$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 .'">'. $topic_title .'</a></td>
                    </tr>
                    <tr>
                        <td><a href="'. $forum_url .'">'. $line[$i]['forum_name'] .'</a>: '. $last_url .' '. $last_time .'</td>
                    </tr>';
	// ############## output ##############
}

echo '</table>';
mysql_close();
?>
Ich hätte gerne, dass es sich meinem Style anpasst (style.css wie binde ich die dann ein oder verlinke bei php bin ich Laie) und das es evtl. ne Beitragsvorschau gibt, sowie dass vor dem Author von steht (also von Nickname).

Geht das irgendwie?

Verfasst: 01.09.2005 23:00
von clauDius
Keine Ideen parat?