PDA

View Full Version : I'm working on an active topics script


Mutt
01-11-2002, 05:30 PM
I miss the old active topics addon for ubb. I had worked on it and and added lots of features to it. My members really liked it.

anyway, changing to VB has left a void for those members. I know we have lots of ways to look up the latest post, but it's just not the same

I've been throwing one together and it's working out pretty nice

here it is on the corvette site
http://www.ccdv.com/forum/activetopics.php

I'll tell you the things I still need to do and maybe one of ya can point me in the right direction. I'm pretty damn good, but honestly, I don't really know php. some of it is easy and then I have stupid stuff like this.

the idea is to list the last 20 posts but only show a thread once so several of the latest posts don't all point to the same thread.
right now it lists every post in a thread. I only want the newest post listed. here's the code I'm using to grab the postids


$getpostids=$DB_site->query("
SELECT post.postid FROM post
WHERE post.visible=1 $datecut
ORDER BY post.dateline DESC
LIMIT ".($limitlower-1).",$perpage
");

//GROUP BY post.threadid


this will give me the last 20 posts made in any forum but I don't want the same thread showing up multiple times.

see the Group by line I have commented out. If I stick that in right before the order by line, it limits the output to just one post per thread alright, but it gives me the first post in each thread instead of the latest. it's almost like it groups them before it orders them. I need it to be ordered before grouping but if I move the group by line to after the order by line, it doesn't work at all.

next

I'd like to limit the text to x amount of chars and tag on a "... read more" but I don't want to screw up the vb code by cutting off the text in the middle of a tag. do you guys know of any other vb hack that already does this so I could take a look at it instead of reinventing the wheel? maybe one of the news scripts?

finally

I forget :) there was something else but oh well.

please shoot me any suggestions or ideas.

newvbuser
01-30-2002, 02:15 PM
Hi I also miss the active threads topics from UBB :(

Unfortunately nobody here is interested in hacking the active thread topic as follows:

I Just want a simple listing in a table that is 25 rows and 2 columns wide, with each topic occupying one row (topic title, with link to it in like this:

<a href="titlelinkhtml">title topic name</a>,

so 25 topics per column as follows:

. Topic 1 . Topic2
. Topic 3 . Topic 4
. Topic 5 . Topic 6
. Topic 7 . Topic 8
. Topic 9 . Topic 10
.... upto Topic 50

Called by ssi or php.

Would you be interested in checking out what I used in UBB to get this thing working as above? (2 column nice table) ?

Mutt
01-30-2002, 06:28 PM
here, use this. you should be able to modify it to build the table. it's from the any forum news hack


/ ###################### Start Active Topics #######################

$getheadssql=$DB_site->query("SELECT threadid,thread.title as title,lastpost,forumid,open,replycount,dateline,vi ews,visible,thread.iconid
".iif($foruminfo[allowicons],',icon.title as icontitle,icon.iconpath','')."
FROM thread
".iif($foruminfo[allowicons],'LEFT JOIN icon ON (icon.iconid = thread.iconid)','')."
WHERE visible=1 AND open!=10
ORDER BY lastpost DESC LIMIT 0,$maxactivetopics
");
while ($getheads=$DB_site->fetch_array($getheadssql)) {
$glforumid=$getheads[forumid];
$getforumnamesql=$DB_site->query("SELECT forumid,title FROM forum WHERE forumid=$glforumid");
$getforumname=$DB_site->fetch_array($getforumnamesql);

if (!$foruminfo[allowicons] or $getheads[iconid]==0) {
if ($showdeficon) {
$glicon='<img src="images/icons/icon1.gif" border="0" alt="">';
} else {
$glicon="&nbsp;";
}
} else {
$glicon="<img src=\"$getheads[iconpath]\" alt=\"$getheads[icontitle]\" width=\"15\" height=\"15\" border=\"0\">";
}

if ($foruminfo[allowicons] and $getheads[pollid]!=0) {
$glicon='<img src="{imagesfolder}/poll.gif" alt="Poll" width="15" height="15" border="0">';
}

$glthreadid=$getheads[threadid];
$gltitle=$getheads[title];
$glforumname=$getforumname[title];
$glreplycount=$getheads[replycount];
$glviewcount=$getheads[views];
$gldateline=vbdate($dateformat,$getheads[dateline]);

if ($bgclass == "alt2") {
$backcolor="{firstaltcolor}";
$bgclass = "alt1";
} else {
$backcolor="{secondaltcolor}";
$bgclass = "alt2";
}

eval("\$getheadsbits .= \"".gettemplate("main_getheadsbit")."\";");
}

newvbuser
01-31-2002, 03:11 AM
Mutt thanks for the reply and tip. I am a vb and PHP newbie. What should i do with this code extract and how should I run it? thanks again.