[TYPO3-german] php script einbinden

Stefan Kaufmann kaufmann at dwwd.ch
Fri Feb 21 13:58:50 CET 2014


Hallo,

Ich möchte die letzten beiträge eines Forums (MyBB) auf meiner Typo3 
Frontseite anzeigen lassen. Dazu müsste ich folgenden php script in ein 
content element ausgeben können:

<?php
define("IN_MYBB", 1);
require_once "./global.php";

     $query = $db->query("
         SELECT t.*
         FROM ".TABLE_PREFIX."threads t
         ORDER BY t.lastpost DESC
         LIMIT 0,10"
     );
     while($thread = $db->fetch_array($query))
     {
         $thread['subject'] = htmlspecialchars_uni($thread['subject']);
         $thread['threadlink'] = get_thread_link($thread['tid']);
         echo "<a 
href=\"http://www.yourforum.com/".$thread['threadlink']."\">".$thread['subject']."</a><br>";
     }

?>

Wie kann ich dies mit Typo3 6.x realisieren?
Ich weiss dass seit 6.0 content objects "USER" or "USER_INT" verwendet 
werden. Wie das aber anstelle ist mir unklar. Verwende das Introduction 
Package, also keine marker oder TV.

Besten Dank für die Hilfe.
Stefan Kaufmann




Alternativer Code (müsste vor HEAD tag gesetzt werden), auch hier etwas 
ratlos bei der Umsetzung:


<?php
chdir("pathtoforums/"); // path to MyBB
define("IN_MYBB", 1);
require("./global.php");
global $mybb, $db, $cache, $lang, $plugins;  // Trim this list of global 
vars, if you want to.
?>


Und code wo die Anzeige sein soll:


<?php
       $query = $db->query("
             SELECT t.*, u.username
             FROM mybb_threads t
             LEFT JOIN mybb_users u ON (u.uid=t.uid)
             WHERE 1=1 AND t.visible='1' AND t.closed NOT LIKE 'moved|%'
             ORDER BY t.lastpost DESC
             LIMIT 0, 6" // Change the last digit to how many recent 
post you want to be shown
         );

     $list = '';
     while($fetch = $db->fetch_array($query))
     {
         $list .= "<strong><a 
href=\"forums/showthread.php?tid={$fetch['tid']}\">".htmlspecialchars_uni($fetch['subject'])."</a></strong><br 
/>";
         $poster = "<a 
href=\"forums/member.php?action=profile&uid=".$fetch['uid']."\">{$fetch['username']}</a>";
         $list .= "Created by: {$poster}<br />";
         $list .= "<i>" .$fetch['replies']. " Replies</i>";
         $list .= "<i> , " .$fetch['views']. " Views</i><br />";
         $list .= " (<i>Last post by: " .$fetch['lastposter']. "</i>)<br 
/><hr width=\"50\"><br />";

     }
     //output
     echo $list;
?>



More information about the TYPO3-german mailing list