[SOLVED] Stand-alone Latest Topics script!

This forum is now closed as part of retiring phpBB2
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

This forum is now closed due to phpBB2.0 being retired.
Registered User
Posts: 6
Joined: Wed Feb 26, 2003 1:56 am
Location: FRANCE

Post by bielle64 »

Last topics works but do you know a script to present ALL subjects classified by forums ? :P
Registered User
Posts: 2
Joined: Wed Dec 03, 2003 9:08 pm
Location: netherlands

Post by Xcalibur »

I'm looking for somthing like this, but only for One forum ...

like as in :

I have news, problems, tactics, suggestions, general chat, etc....

but I only want to show the latest topics in the " news " forum.
AND, if possable, also the post itself.
also the ammount of reply's, but not the reply's themselves

I need this for the 1st page u get on, so u immidiatly see the news, insted of having to go to the forum

Registered User
Posts: 5
Joined: Thu Dec 04, 2003 2:38 pm

Post by sr20detsilvia007 »

Warning: main(): stream does not support seeking in <path> on line 10

this is the error that im getting when its trying to access the config.php file

?? I am putting the path but the path on the error is different than i am specifiy on the page
Registered User
Posts: 5
Joined: Thu Dec 04, 2003 2:38 pm

Post by sr20detsilvia007 »

Registered User
Posts: 238
Joined: Sun Dec 07, 2003 10:36 pm
Location: EU

Post by majjk99 »

Shantra wrote:

Code: Select all

 *   Mod Title: PHP Latest Topics
 *   Mod Version: 1.0.0
 *   Author: Erik Holm, eholm_oslo@yahoo.no

 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.

// ***** Config Start *****
$dbname = "forums"; // Database name.
$tbtopics = "phpbb_topics"; // Topics table name.
$tbusers = "phpbb_users"; // Users table name.
$forumpath = "phpbb"; // Path to forums. Do NOT end with /
$numtopics = "10"; // Number of topic rows
// ***** Config End *****

include($forumpath . '/config.php'); // Config file holds password and other details. 

$connect = mysql_connect($dbhost, $dbuser, $dbpasswd); 
if (!$connect) { echo "Can't connect to forums database"; return; } 
$query = mysql_query("SELECT topic_id, topic_title, topic_poster, topic_replies, topic_views, user_id, username FROM $tbtopics LEFT JOIN $tbusers ON $tbtopics.topic_poster=$tbusers.user_id WHERE topic_status = 0 ORDER BY topic_id DESC LIMIT $numtopics"); 

echo "<table width=\"500\" border=\"1\" cellspacing=\"0\" cellpadding=\"4\">";
echo "<tr><td width=\"100%\"align=\"center\">";
echo "Topic";
echo "</td><td align=\"center\">";
echo "Replies";
echo "</td><td align=\"center\">";
echo "Views";
echo "</td><td align=\"center\">";
echo "Posted by";
echo "</td></tr>";

while ($row = mysql_fetch_array($query)) 

$topic_title = stripslashes($row['topic_title']);
$topic_poster = stripslashes($row['username']);
$topic_poster_id = $row['topic_poster'];

echo "<tr><td >";
echo "<a href=\"" . $forumpath . "/viewtopic.php?t=" . $row['topic_id'] . "\">" . $topic_title . "</a>";
echo "</td><td align=\"right\">";
echo $row['topic_replies'];		
echo "</td><td align=\"right\">";
echo $row['topic_views'];	
echo "</td><td >";
if ($topic_poster_id == -1) // Check if poster is guest or member.
     echo "Guest";
     echo "<a href=\"" . $forumpath . "/profile.php?mode=viewprofile&u=" . $row['topic_poster'] . "\">" . $topic_poster . "</a>";
echo "</td></tr>";

echo "</table>";

I have been spending too much time now trying to sort out my tiny problem... so I'm asking you guys instead:
I'm using the code by Shantra but I would like to change a few bits. I'm only interested in the title of the topic/message and the message itself. So I suppose I can change

$tbusers = "phpbb_users"; // Users table name.

so that it uses a table for the 'message text' instead. What is that table called? Is it phpbb_posts_text? I will also have to change this bit

$query = mysql_query("SELECT topic_id, topic_title, topic_poster, topic_replies, topic_views, user_id, username FROM $tbtopics LEFT JOIN $tbusers ON $tbtopics.topic_poster=$tbusers.user_id WHERE topic_status = 0 ORDER BY topic_id DESC LIMIT $numtopics");

Here I suppose I can remove topic_poster, topic_replies, topic_views, user_id and username. Instead I will have to add XXXX and YYYY. What are XXXX and YYYY called? When this is done I only have to change the last bit... I should be able to sort that out myself.

Any ideas anyone?


Registered User
Posts: 74
Joined: Sun Jul 28, 2002 4:57 am

Post by dvduval »

I decided to get rid of the scrolling and create a separate "Active Topics" page. Here is what it evolved into:
PHP Link Directory - one of the best free link directory scripts available.
Registered User
Posts: 17
Joined: Sat Jan 31, 2004 11:54 pm

Post by blackice105 »

im making an html homepage for my site, and i want latest topics on, i used the shantra code and i filled in all the stuff i need to fill in, but it is not working? what can i do?
Registered User
Posts: 1
Joined: Sat Jul 31, 2004 5:43 pm

Post by wafel »

Hey, I have inserted Antony's script on my page, and everything works perfect, but only under web-browsers different from Internet Explorer. All Netscape, Mozilla etc browsers works brilliant with this code, but when one is trying to view my site with IE browser, it doesnt display the site with this script, but automatically redirect him to the main page of the forum! Geez. Phpbb forum is on the lycos server, does it matter ? Anyway, can anyone help me?
Sorry for my English..
Registered User
Posts: 2
Joined: Fri Sep 17, 2004 5:43 pm

Post by eworried »

I have gotten this script to work :)

But. I was wondering how I can only show announcements or/and show the topics inside a particular forum. Is there any solution?
Registered User
Posts: 10
Joined: Sat Jan 20, 2007 5:10 pm

Re: [SOLVED] Stand-alone Latest Topics script!

Post by vdf_belial »

Subject: [SOLVED] Stand-alone Latest Topics script!
Antony wrote: Mine scrolls. :roll:

Code: Select all

// How Many Topics you want to display?
$topicnumber = 10;
// Scrolling towards up or down?
$scroll = "up";
// Change this to your phpBB path
$urlPath = "http://yourdomain.com/phpBB";

// Database Configuration (Where your phpBB config.php file is located
include 'http://yourdomain.com/config.php';

$table_topics = $table_prefix. "topics";
$table_forums = $table_prefix. "forums";
$table_posts = $table_prefix. "posts";
$table_users = $table_prefix. "users";
$link = mysql_connect("$dbhost", "$dbuser", "$dbpasswd") or die("Could not connect");
mysql_select_db("$dbname") or die("Could not select database");

$query = "SELECT t.topic_id, t.topic_title, t.topic_last_post_id, t.forum_id, p.post_id, p.poster_id, p.post_time, u.user_id, u.username
FROM $table_topics t, $table_forums f, $table_posts p, $table_users u
WHERE t.topic_id = p.topic_id AND 
f.forum_id = t.forum_id AND 
t.topic_status <> 2 AND 
p.post_id = t.topic_last_post_id AND 
p.poster_id = u.user_id
ORDER BY p.post_id DESC LIMIT $topicnumber";
$result = mysql_query($query) or die("Query failed");

print "<marquee id=\"recent_topics\" behavior=\"scroll\" direction=\"$scroll\" height=\"170\" scrolldelay=\"100\" scrollamount=\"2\" onMouseOver=\"document.all.recent_topics.stop()\" onMouseOut=\"document.all.recent_topics.start()\">
<table cellpadding='3' cellSpacing='2' width='350'>";
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo  "<tr valign='top'><td><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><font color=\"#FFCC00\"><b><a href=\"$urlPath/viewtopic.php?topic=$row[topic_id]&forum=$row[forum_id]\">" .
$row["topic_title"] .
"</a></td></font></b><td><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><font color=\"#C0C0C0\"> by: <a href=\"$urlPath/profile.php?mode=viewprofile&u=$row[user_id]\">" .
$row["username"] .
"</td><td><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><font color=\"#C0C0C0\">" .
date('F j, Y, g:i a', $row["post_time"]) .
print "</table></marquee>";

Regarding this post or not only this one, i was wondering is there a way of not showing some private posts information, because i have a private section on my forum and i don't want people to see the posts in them. I'm guessing that i have to add/modifiy a line afther the WHERE statement. I tried something but it didn't work.
If there's someone who can help that would be great. Thanks.
Post Reply

Return to “[2.0.x] MOD Requests”