Seite 4 von 4

Re: Eigene Seite ins Forum integrieren?

Verfasst: 23.02.2012 18:30
von albert0583
Na ich dachte die ganzen Angaben zu den Tabellen wo die Variablen drin stehen

Re: Eigene Seite ins Forum integrieren?

Verfasst: 23.02.2012 18:56
von TW1920
Nein, erstmal noch nicht, da du das ganze dann in eine spezielle Abfrage einbaun musst, damit auch 3 oder mehr Beiträge gleichzeitig ausgegeben werden können ;)

Das wäre der erste Schritt. ;)

Re: Eigene Seite ins Forum integrieren?

Verfasst: 23.02.2012 19:05
von albert0583
aha verstehe.
also das mit der datenbank scheint nun zu funktionieren aber es kommt eine Fehlermeldung wenn ich die datei direkt aufrufe
Parse error: syntax error, unexpected '<', expecting ')' in /var/www/web977/html/portal/last_topics.php on line 59
hab schon in zeile 59 nachgesehen nur dieses '<' ist nicht drin

Hab dir ne PN geschrieben. Schau mal rein

Re: Eigene Seite ins Forum integrieren?

Verfasst: 23.02.2012 20:34
von TW1920
Sorry, ich hab einen kleinen Fehler gemacht :oops:
Hab vergessen ' zu setzten und das < existiert ;)

So, nun müsste der code passen: 8)

Code: Alles auswählen

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

$config_path = '/';   // path to config.php 
$root_path = 'http://www.vfbfansauerbach.de/portal/';      // link path 
// ############         Edit above         ####################################### 

$path = dirname(__FILE__); 

$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 " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . POSTS_TABLE . " p2, " . USERS_TABLE . " 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 = $db->sql_query($sql);

$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_hour = date('H:i' ,  $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' ); 
   $t1 = $root_path.'viewtopic.php?f='.$forum_id.'&t='.$topic_id.'&p='.$line[$i]['topic_last_post_id'].'#p'.$line[$i]['topic_last_post_id'];
   $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 ############## 
	$template->assign_vars(array(
		'LASTTOPICS'            => sprintf('<tr> 

            <td style="width: 50%" bgcolor="#DBD3B4"><a href="'. $t1 .'" target="_blank" style="text-decoration:none"> 
            <font face="Verdana, Arial, Helvetica, sans-serif" style="font-size:11px" >'. $topic_title .'</a></font>&nbsp;&nbsp;<a href="'. $t1 .'"><img src="../forum/icon_topic_latest.gif" width="11" height="9" alt="Neuester Beitrag" /></a></td> 
            <td style="width: 20%" bgcolor="#DBD3B4"> 
            <font face="Verdana, Arial, Helvetica, sans-serif" style="font-size:11px">'. $last_url .'</font></td> 
            <td style="width: 20%" bgcolor="#DBD3B4"> 
            <font face="Verdana, Arial, Helvetica, sans-serif" style="font-size:11px">'. $last_time .'</font></td> 
         <td style="width: 10%" bgcolor="#DBD3B4"> 
            <font face="Verdana, Arial, Helvetica, sans-serif" style="font-size:11px">'. $last_hour .'</font></td> 


        </tr>'),
	));
   // ############## output ############## 
} 


?>





Re: Eigene Seite ins Forum integrieren?

Verfasst: 23.02.2012 20:38
von albert0583
Ruf mal den Link auf:

http://www.vfbfansauerbach.de/portal/last_topics.php

da haben wir wieder das Prob mit der DB oder?