View previous topic :: View next topic |
Author |
Message |
Potato-VS- Registered User
Joined: 16 Jul 2002 Location: Ontario Canada Posts: 1562
|
Posted: Fri Feb 27, 2004 7:39 pm Post subject: Latest forum posts script |
|
|
Does anyone know a link to a good "latest forum posts" PHP script? Im looking for one for the ASF and OrcishDesign website but I still cant seem to figure out whats best . Anyone know a good link? |
|
Back to top |
|
|
Robert E. Lee Registered User
Joined: 18 Jul 2001
Posts: 2904
|
Posted: Sat Feb 28, 2004 12:54 am Post subject: |
|
|
What forum software? _________________
|
|
Back to top |
|
|
Potato-VS- Registered User
Joined: 16 Jul 2002 Location: Ontario Canada Posts: 1562
|
Posted: Sat Feb 28, 2004 7:24 am Post subject: |
|
|
PHPBB2 but its got the IVision stuff added on. |
|
Back to top |
|
|
Stevo Ville Supporter
Joined: 08 Dec 2002 Location: Orange County Guild: TVR Posts: 9514
|
|
Back to top |
|
|
Stevo Ville Supporter
Joined: 08 Dec 2002 Location: Orange County Guild: TVR Posts: 9514
|
Posted: Sun Mar 28, 2004 10:52 pm Post subject: |
|
|
Here's a script I put together that does this. The only problem is that it doesn't cut off when the title is long and add ... like the one on the ville does.
Code: | <?php
$db = mysql_connect("host", "user", "pass");
mysql_select_db("database",$db);
$result = mysql_query("SELECT * FROM phpbb_topics",$db);
$sql = "SELECT * FROM phpbb_topics ORDER BY topic_id DESC LIMIT 15";
$result = mysql_query($sql);
while ($myrow = mysql_fetch_array($result)) {
$t_id = $myrow["topic_id"];
$t_name = $myrow["topic_title"];
echo "<a href=\"/forum/viewtopic.php?t=$t_id\">$t_name</a><br>\n";
}
?> |
This works as long as you have phpbb_ as the prefix to your tables. Otherwise, replace them all with the right prefix. Oh and be sure to replace host, user, pass, and database with the info from your db. Oh and if your forum isn't located in the folder called "forum" then replace it in the line third from the bottom. Hope that helps until I can figure out how to do the cutoff thing.
Edit: I changed the variables so they don't interfere with other scripts you may have running. _________________
The Official TVR Website
Fopp
Song of the Week |
|
Back to top |
|
|
Stevo Ville Supporter
Joined: 08 Dec 2002 Location: Orange County Guild: TVR Posts: 9514
|
Posted: Mon Mar 29, 2004 8:58 pm Post subject: |
|
|
I also noticed that it only shows the latest threads and not the latest threads to be replied to. I'm not sure how I would do that.
I'm a beginner with this kind of stuff. _________________
The Official TVR Website
Fopp
Song of the Week |
|
Back to top |
|
|
Stevo Ville Supporter
Joined: 08 Dec 2002 Location: Orange County Guild: TVR Posts: 9514
|
Posted: Mon Mar 29, 2004 11:25 pm Post subject: |
|
|
Hey I fixed it. It was an easy fix, just used a different field to sort it.
Here is the new code:
Code: | <?php
$db = mysql_connect("host", "user", "pass");
mysql_select_db("database",$db);
$result = mysql_query("SELECT * FROM phpbb_topics",$db);
$sql = "SELECT * FROM phpbb_topics ORDER BY topic_last_post_id DESC LIMIT 15";
$result = mysql_query($sql);
while ($myrow = mysql_fetch_array($result)) {
$t_id = $myrow["topic_id"];
$t_name = $myrow["topic_title"];
echo "<a href=\"/forum/viewtopic.php?t=$t_id\">$t_name</a><br>\n";
}
?> |
Do you still need this or am I wasting my time. _________________
The Official TVR Website
Fopp
Song of the Week |
|
Back to top |
|
|
lfhsg Registered User
Joined: 07 Feb 2004
Posts: 20
|
Posted: Wed Apr 28, 2004 1:12 am Post subject: |
|
|
na you're not wasting your time....i was looking for this too _________________ lfhsg (Blazefury) |
|
Back to top |
|
|
Stevo Ville Supporter
Joined: 08 Dec 2002 Location: Orange County Guild: TVR Posts: 9514
|
|
Back to top |
|
|
Stevo Ville Supporter
Joined: 08 Dec 2002 Location: Orange County Guild: TVR Posts: 9514
|
Posted: Wed Apr 28, 2004 5:16 pm Post subject: |
|
|
Here it is:
Code: | <?php
$db = mysql_connect("host", "user", "pass");
mysql_select_db("database",$db);
$result = mysql_query("SELECT * FROM phpbb_topics",$db);
$sql = "SELECT * FROM phpbb_topics ORDER BY topic_last_post_id DESC LIMIT 15";
$result = mysql_query($sql);
while ($myrow = mysql_fetch_array($result)) {
$t_id = $myrow["topic_id"];
$t_name = limit_text($myrow["topic_title"],16);
echo "<a href=\"/forum/viewtopic.php?t=$t_id\">$t_name...</a><br>\n";
}
function limit_text( $text, $limit )
{
if( strlen($text)>$limit )
{
$text = substr( $text,0,$limit );
$text = substr( $text,0,-(strlen(strrchr($text,' '))) );
}
return $text;
}
?> |
_________________
The Official TVR Website
Fopp
Song of the Week |
|
Back to top |
|
|
lfhsg Registered User
Joined: 07 Feb 2004
Posts: 20
|
Posted: Wed Apr 28, 2004 5:19 pm Post subject: |
|
|
wow that's great....
i was going to ask for that
although i use invision, but hey i think i can mess around with the code.
thanks _________________ lfhsg (Blazefury) |
|
Back to top |
|
|
|