PDA

View Full Version : Announcements in threads?


X-Fan
07-20-2002, 03:31 AM
Is it possible to have announcements on a forum show up not only in each forum, but in each thread in selected forums?

Xenon
07-20-2002, 11:53 AM
you mean the content of the announcements or just the titles of announcements like you can see and click on in forumdisplay?

X-Fan
07-20-2002, 02:26 PM
Like in forumdisplay.

Xenon
07-20-2002, 04:13 PM
hmm it isn't teste but worth a try:
open your forumdisplay.php an copy the lines after // get announcements

showthread.php after:
$threadid = intval($threadid);
$thread = verifyid("thread",$threadid,1,1);
add$forumid=$thread[forumid]; and after that add the part from forumdisplay.php

then just add $announcement into your showthread template

X-Fan
07-21-2002, 03:39 AM
You mean add this bit from forumdisplay.php into showthread.php:


// get announcements
$datenow=time();
$forumlist=getforumlist($forumid,'forumid');
$doneannouncements = 0;
if ($announcement=$DB_site->query_first("SELECT announcementid,startdate,title,user.username,user. userid,user.usertitle,user.customtitle,visits
FROM announcement
LEFT JOIN user
ON user.userid=announcement.userid
WHERE startdate<=$datenow AND enddate>=$datenow
AND $forumlist
ORDER BY startdate DESC
LIMIT 1")) {
if ($foruminfo[allowratings]) {
$thread[rating]='clear.gif';
eval("\$threadrating = \"".gettemplate('forumdisplaybit_threadrate')."\";");
$backcolor = '{secondaltcolor}';
$bgclass = "alt2";
} else {
unset($threadrating);
$backcolor = '{firstaltcolor}';
$bgclass = "alt1";
}

if ($announcement[customtitle]==2) {
$announcement[usertitle] = htmlspecialchars($announcement[usertitle]);
}
$announcement[postdate]=vbdate($dateformat,$announcement[startdate]);

if ($announcement[startdate]>$bbuserinfo[lastvisit]) {
$announcement[icon]='newannounce.gif';
} else {
$announcement[icon]='announce.gif';
}
eval("\$announcement = \"".gettemplate('forumdisplay_announcement')."\";");
$doneannouncements = 1;
}


?

Xenon
07-21-2002, 03:47 PM
yes ;)

just giv it a try ;)

X-Fan
07-22-2002, 08:59 AM
What about the $foruminfo[allowratings] variable; does that need to be included?

I don't want to include any extra code/queries than are absolutely necessary.

Xenon
07-22-2002, 03:21 PM
hmm i don't see it's necessary, so you can take out the whole clause