Verfasst: 08.05.2006 17:50
In wie weit gab es dahingehend Probleme?
führt dazu, dass der Startwert für den letzten Beitrag einer Seite zu hoch ist.mgutt hat geschrieben:floor(($replies + 1) / $board_config['posts_per_page']) * $board_config['posts_per_page']
In der Tat, das kann ich bestätigen. War mir bisher noch gar nicht aufgefallen.easygo hat geschrieben:führt dazu, dass der Startwert für den letzten Beitrag einer Seite zu hoch ist.mgutt hat geschrieben:floor(($replies + 1) / $board_config['posts_per_page']) * $board_config['posts_per_page']
Dadurch kommts zu einer Fehlermeldung (nicht gefunden)
Code: Alles auswählen
$total_pages_topic = (($replies + 1) / $board_config['posts_per_page'] <= 1) ? '' : '&start=' . ( floor($replies / intval($board_config['posts_per_page'])) * intval($board_config['posts_per_page']));
Code: Alles auswählen
<?php
if (!defined('IN_PHPBB'))
{
die('Hacking attempt');
}
// ############ Edit below ########################################
$topic_length = '80'; // length of topic title
$topic_limit = '30'; // limit of displayed topics
$special_forums = '1'; // specify forums ('0' = no; '1' = yes)
$forum_ids = '53,54,55,61,62'; // IDs of forums; separate them with a comma
$config_path = '/'; // path to config.php
$root_path = '/forum/'; // link path
// ############ Edit above ########################################
$path = dirname(__FILE__);
include_once($path.$config_path .'config.php');
// die naechsten Zeilen werden nicht mehr benötigt 2.0.18
// 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="10" cellspacing="0" border="0" align="center" class="forumline">
<tr>
<th colspan="3">Das sind die '. $topic_limit .' neuesten Beiträge in diesem Forum:</th>
</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++ )
{
$word_censor = ( count($orig_word) ) ? preg_replace($orig_word, $replacement_word, $line[$i]['topic_title']) : $line[$i]['topic_title'];
$topic_title = ( strlen($line[$i]['topic_title']) < $topic_length ) ? $word_censor : substr(stripslashes($word_censor), 0, $topic_length);
$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) .'...';
// ############## output ##############
echo '<tr>
<td valign="top" nowrap="nowrap" class="row1"><span class="topictitle"><a href="'. $topic_url .'">'. $topic_title .'</a></span></td>
</tr>';
// ############## output ##############
}
echo '</table>';
mysql_close();
?>
Code: Alles auswählen
$topic_url = $root_path .'viewtopic.php?t=' . $topic_id;
Code: Alles auswählen
$topic_url = $root_path .'ftopic' . $topic_id . '.html';
Hallo mgutt,mgutt hat geschrieben:@ IPB
tolles recent was du da hast.. jeder User, der keine Cookies akzeptiert wird doch ausgeloggt?! wer schreibt den sowas![]()
Code: Alles auswählen
<?php
//Benötigte Dateien und Variablen von phpBB
define('IN_PHPBB', true);
$phpbb_root_path = '../forum/';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
//Session auslesen und Benutzer-Informationen laden
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//Dieser Block kann weggelassen werden, wenn du nur den die Userdaten brauchst und auf den phpBB-Header verzichen möchtest
$page_title = 'Die neuesten Beiträge';
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
//***** Inhaltsbereich ******/
echo '<h1>Die neuesten Beiträge</h1>
<p> </p>';
include($phpbb_root_path . 'recent.'.$phpEx);
?>
Danke für den Tipp!!! Meinst Du, es könnte so klappen:mgutt hat geschrieben:naja. du musst urls immer an die funktion append_sid() übergeben. (durch die wird überhaupt die session an die url angehangen)
nimm dir als beispiel eine url aus der viewtopic etc. dann siehst du was ich meine.
Code: Alles auswählen
$topic_url = append_sid($root_path . 'viewtopic.php?t=' . $topic_id);