Short URL und Recent Mod für Externe seiten

In diesem Forum können Mod-Autoren ihre Mods vorstellen, die sich noch im Entwicklungsstatus befinden. Der Einbau in Foren im produktiven Betrieb wird nicht empfohlen.
Forumsregeln
phpBB 2.0 hat das Ende seiner Lebenszeit überschritten
phpBB 2.0 wird nicht mehr aktiv unterstützt. Insbesondere werden - auch bei Sicherheitslücken - keine Patches mehr bereitgestellt. Der Einsatz von phpBB 2.0 erfolgt daher auf eigene Gefahr. Wir empfehlen einen Umstieg auf phpBB 3.0, welches aktiv weiterentwickelt wird und für welches regelmäßig Updates zur Verfügung gestellt werden.
Antworten
Benutzeravatar
sts
Mitglied
Beiträge: 345
Registriert: 04.04.2004 18:45

Short URL und Recent Mod für Externe seiten

Beitrag von sts »

Hallo,

ich setzte auf einem Board den Short URL Mod "larsneo" ein (letzte Version). Als auch in der index des Boardes den aktuellen Recent Mod ( http://www.phpbb.de/moddb/recent_topics ).
Soweit so gut, alle Daten werden in der index des Boardes als HTML ausgegeben.
Nutze ich nun die "externe" Version des Mod´s, dh. ich include den Recent Mod (externe URL, andere IP, gleicher Server). Nun werden alle URLs wieder als viewtropic.php=324232 statt ftropic21331.html angezeigt.
Gibt es hierfür evt. eine Lösung?

Quellencode des Externen Recent Mods um Mitgliederanzeige beschnitten.

Code: Alles auswählen

<?php
// ############         Edit below         ########################################
$topic_length = '120';	// length of topic title
$topic_limit = '5';	// limit of displayed topics
$special_forums = '1';	// specify forums ('0' = no; '1' = yes)
$forum_ids = '1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,18,19,20,21';		// IDs of forums; separate them with a comma

$config_path = '/';	// path to config.php
$root_path = 'http://url-des-forums.de/';		// 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"> Die letzten '. $topic_limit .' Beiträge im Board</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' ) ? '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 .'">'. $topic_title .'</a></td>
                    </tr>';
	// ############## output ##############
}

echo '</table>';
mysql_close();
?>
Benutzeravatar
sts
Mitglied
Beiträge: 345
Registriert: 04.04.2004 18:45

Beitrag von sts »

Mein versuch war:

Code: Alles auswählen

	$topic_url = $root_path .'ftopic'. $topic_id .html;
Leider wird hier der Punkt nicht als Punkt wiedergegeben sonder als Teil des Dateinamens.
Sprich statt
ftopic1215.html
wurde ausgegeben:
ftopic1215html
Benutzeravatar
sts
Mitglied
Beiträge: 345
Registriert: 04.04.2004 18:45

Beitrag von sts »

Lösung:

Code: Alles auswählen

	$topic_url = $root_path .'ftopic'. $topic_id .'.html';
Danke
Benutzeravatar
sts
Mitglied
Beiträge: 345
Registriert: 04.04.2004 18:45

Beitrag von sts »

So nun ist er XHTML valide UTF8 -> http://www.phpbb.de/viewtopic.php?t=878 ... highlight=

Code: Alles auswählen

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

$config_path = '/';   // path to config.php
$root_path = '/';      // 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 ' <b>Die letzten '. $topic_limit .' Beiträge im Board </b> <br />
';
// ############## 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 .'ftopic'. $topic_id .'.html';

   $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 '
                        '. $topic_type .'<a href="'. $topic_url .'">'. $topic_title .'</a><br />
                   ';
   // ############## output ##############
}


mysql_close();
?>
Antworten

Zurück zu „phpBB 2.0: Mods in Entwicklung“