FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Latest forum posts script

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    The Ville.org Half-Life Gaming Community Forum Index -> Tech Corner
View previous topic :: View next topic  
Author Message
Potato-VS-
Registered User


Joined: 16 Jul 2002
Location: Ontario Canada
Posts: 1562

PostPosted: Fri Feb 27, 2004 7:39 pm    Post subject: Latest forum posts script Reply with quote

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
View user's profile Send private message Send e-mail
Robert E. Lee
Registered User


Joined: 18 Jul 2001

Posts: 2904

PostPosted: Sat Feb 28, 2004 12:54 am    Post subject: Reply with quote

What forum software?
_________________
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Potato-VS-
Registered User


Joined: 16 Jul 2002
Location: Ontario Canada
Posts: 1562

PostPosted: Sat Feb 28, 2004 7:24 am    Post subject: Reply with quote

PHPBB2 but its got the IVision stuff added on.
Back to top
View user's profile Send private message Send e-mail
Stevo
Ville Supporter
Ville Supporter


Joined: 08 Dec 2002
Location: Orange County Guild: TVR
Posts: 9514

PostPosted: Sun Mar 28, 2004 7:33 pm    Post subject: Reply with quote

Yeah I could use that, too. I have phpBB 2.0.7. I could probably do it if I had to.
_________________

The Official TVR Website

Fopp
Song of the Week
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Stevo
Ville Supporter
Ville Supporter


Joined: 08 Dec 2002
Location: Orange County Guild: TVR
Posts: 9514

PostPosted: Sun Mar 28, 2004 10:52 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Stevo
Ville Supporter
Ville Supporter


Joined: 08 Dec 2002
Location: Orange County Guild: TVR
Posts: 9514

PostPosted: Mon Mar 29, 2004 8:58 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Stevo
Ville Supporter
Ville Supporter


Joined: 08 Dec 2002
Location: Orange County Guild: TVR
Posts: 9514

PostPosted: Mon Mar 29, 2004 11:25 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
lfhsg
Registered User


Joined: 07 Feb 2004

Posts: 20

PostPosted: Wed Apr 28, 2004 1:12 am    Post subject: Reply with quote

na you're not wasting your time....i was looking for this too
_________________
lfhsg (Blazefury)
Back to top
View user's profile Send private message Send e-mail
Stevo
Ville Supporter
Ville Supporter


Joined: 08 Dec 2002
Location: Orange County Guild: TVR
Posts: 9514

PostPosted: Wed Apr 28, 2004 3:19 pm    Post subject: Reply with quote

Oh ok. I have an updated script that cuts off the lines and adds ... that I will post when I can.
_________________

The Official TVR Website

Fopp
Song of the Week
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Stevo
Ville Supporter
Ville Supporter


Joined: 08 Dec 2002
Location: Orange County Guild: TVR
Posts: 9514

PostPosted: Wed Apr 28, 2004 5:16 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
lfhsg
Registered User


Joined: 07 Feb 2004

Posts: 20

PostPosted: Wed Apr 28, 2004 5:19 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    The Ville.org Half-Life Gaming Community Forum Index -> Tech Corner All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group