Seite 1 von 1
Beiträge vom Forum auf Hauptseite mit Anzahl von Antworten
Verfasst: 12.02.2003 20:26
von Bob
Hallo,
wie
hier Beschrieben, lasse ich jetzt meine Beiträge auf meiner Hauptseite anzeigen. Ich würde jetzt gerne noch die Anzahl der Beiträge in Klammern hinter die Themen haben. Geht das?
Verfasst: 13.02.2003 13:48
von Bob
Hat denn keiner eine Idee?

Verfasst: 13.02.2003 14:11
von esperitox
rdf.php
[suchen]
Code: Alles auswählen
// SQL statement to fetch active topics of public forums
$sql = "SELECT DISTINCT t.topic_title, t.topic_last_post_id, p.post_time, f.forum_name
FROM " . TOPICS_TABLE . " AS t, " . POSTS_TABLE . " AS p, " . FORUMS_TABLE . " AS f
WHERE
t.forum_id = f.forum_id
AND f.auth_view = " . AUTH_ALL . "
AND p.topic_id = t.topic_id
AND p.post_id = t.topic_last_post_id
$sql_where
ORDER BY p.post_time DESC LIMIT $count";
$topics_query = $db->sql_query($sql);
if ( !$topics_query )
{
die("Failed obtaining list of active topics");
}
else
{
$topics = $db->sql_fetchrowset($topics_query);
}
if ( count($topics) == 0 )
{
die("No topics found");
}
else
{
// $topics contains all interesting data
for ($i = 0; $i < count($topics); $i++)
{
$title = $topics[$i]['topic_title'];
$url = $viewtopic_url . "?" . POST_POST_URL . "=" . $topics[$i]['topic_last_post_id'] . "#" . $topics[$i]['topic_last_post_id'];
$rdf .= "
<item>
<title>" . $title . "</title>
<link>" . $url . "</link>
</item>
";
}
}
[Ersetzen durch]
Code: Alles auswählen
// SQL statement to fetch active topics of public forums
$sql = "SELECT DISTINCT t.topic_title, t.topic_last_post_id, t.topic_replies, p.post_time, f.forum_name
FROM " . TOPICS_TABLE . " AS t, " . POSTS_TABLE . " AS p, " . FORUMS_TABLE . " AS f
WHERE
t.forum_id = f.forum_id
AND f.auth_view = " . AUTH_ALL . "
AND p.topic_id = t.topic_id
AND p.post_id = t.topic_last_post_id
$sql_where
ORDER BY p.post_time DESC LIMIT $count";
$topics_query = $db->sql_query($sql);
if ( !$topics_query )
{
die("Failed obtaining list of active topics");
}
else
{
$topics = $db->sql_fetchrowset($topics_query);
}
if ( count($topics) == 0 )
{
die("No topics found");
}
else
{
// $topics contains all interesting data
for ($i = 0; $i < count($topics); $i++)
{
$title = $topics[$i]['topic_title'];
$replies = $topics[$i]['topic_replies'];
$url = $viewtopic_url . "?" . POST_POST_URL . "=" . $topics[$i]['topic_last_post_id'] . "#" . $topics[$i]['topic_last_post_id'];
$rdf .= "
<item>
<title>" . $title . "</title> (" . $replies . ")
<link>" . $url . "</link>
</item>
";
}
}
esperitox
Verfasst: 13.02.2003 14:30
von Bob
Danke, funktioniert.
Und wie kann ich jetzt noch die Themen am ende durch
"..." ersetzen lassen, falls ein Thema mal zu lang sein sollte?
Verfasst: 13.02.2003 17:56
von esperitox
rdf.php
[Suchen]
[Ersetzen durch]
$topic_title_size = 20;
$title = strlen($topics[$i]['topic_title']) > $topic_title_size ? substr($topics[$i]['topic_title'], 0, ($topic_title_size)) . "..." : $topics[$i]['topic_title'];
Bei dem Rot markierten kannst du einstellen wie lang der topic title sein darf bevor ... angezeigt wird
esperitox
Verfasst: 13.02.2003 18:48
von Bob
Danke, alles bestens.
