Seite 1 von 1

Problem mit last_5_topics

Verfasst: 03.01.2008 18:02
von netdestroyer
Hallo Leute...
ich brauch einmal eure Hilfe.
undzwar lass ich mir mit einem Script die neusten 5 Beiträge des Forums auf meiner HP anzeigen.

der Code dafür sieht folgender maßen aus:

Code: Alles auswählen

<style type="text/css">
#General_arabic {
   font-family: Verdana, Arial, Helvetica, sans-serif;
   font-size: xx-small;
   font-weight: normal;
   height: 100%;
   width: 100%;
   direction: ltr;
   background-color:#FDD16F;
}

a:hover {
   text-decoration: underline overline;
}
a:link {
   text-decoration: none;
}

a {
   text-decoration: none;
   color: black;
}

a:visited {
   text-decoration: none;
}

</style>
    
<?php
    /**
    *
    * @package phpBB3
    * @copyright (c) 2005 phpBB.bz Group
    * @license http://opensource.org/licenses/gpl-license.php GNU Public License
    * 
    */

    /**
    * @ignore
    */
    define('IN_PHPBB', true);
    $phpbb_root_path = './';
    $phpEx = substr(strrchr(__FILE__, '.'), 1);
    include($phpbb_root_path . 'common.'.$phpEx);

//forums you do not want to show

$forums =',';

// topics limit
$limit ='5';

   $sql = "SELECT topic_id,topic_title
          FROM phpbb3_topics
          WHERE forum_id    NOT IN ('$forums')
          AND topic_approved = 1 ORDER BY topic_id DESC";
    //$result = $db->sql_query($sql);
    $result = $db->sql_query_limit($sql, $limit);
    //echo $sql;


    // show out put

    echo "<div id='General_arabic'><ul>";
    while (($row = $db->sql_fetchrow($result)) ) {
	echo "<li>";
        echo "<a  target='_blank' href='viewtopic.php?t=";
        echo $row[topic_id];
       echo"'>";
       echo $row[topic_title];
        echo "</a></li>";
        }
        echo "<ul></div>";



// Free resultset
mysql_free_result($result);
    

?>

das lasse ich dann per iframe aufrufen.

das ganze funktioniert soweit ganz gut... außer die Darstellung.
Ich lade das ganze in einer navibox (phpkit) am rechten Rand der Seite und die ist nicht breit genug, wodurch der text 2-3 zeilen einnimmt und das ganze nicht mehr schön aussieht.

ich habe mir jetzt folgendes überlegt... hab das schonmal irgendwo gesehn...

Der Text darf nicht mehr als z.B. 20 Zeichen haben... wenn doch wird er mit "..." weitergeführt...
z.B.
heißt der thread "Hans" dann passt das
heißt der thread "Hans geht Pflaumen einkaufen"
soll das so aussehen: "Hans geht Pflaumen ..."

wie lässt sich das bewerkstelligen?

Verfasst: 04.01.2008 01:32
von Kendoo

Code: Alles auswählen

echo "<a  title='".$row[topic_title]."' target='_blank' href='viewtopic.php?t="; 
        echo $row[topic_id]; 
       echo"'>"; 
       echo (strlen($row[topic_title]>20))?substr($row[topic_title],0,20)."...":$row[topic_title]; 
        echo "</a></li>";

Verfasst: 04.01.2008 12:49
von netdestroyer
Dank dir...

leider musste ich feststellen, dass das script nur die zuletzt erstellten threads anzeigt und nicht die neusten threads, in denen etwas gepostet wurde.

sowas suche ich :- /

kann mir da einer weiter helfen?

Verfasst: 04.01.2008 14:34
von Kendoo
http://www.phpbb.de/viewtopic.php?t=157 ... c&start=10

das ist zwar eigentlich für etwas anderes gedacht, sollte aber auch für Deine Zwecke funktionieren