View Full Version : Announcements on Forum Home
Hi,
I want to show announcement "bits" on forum home, just like in forumdisplay_threadlist, but using an own template. Could anyone help me? :)
Vivi Ornitier
08-22-2002, 10:53 PM
Do you want it so you can choose to put it on the index when you make the announcement?
That'd be very cool, though I'm already satisfied when it only shows "global" announcements. To make forumhome an own entity in the whole "where to show announcement" system is probably much more work - not that I understand these things. If it is made so I have to chose whether or not to show on index, I have to be able to edit existing announcements.
Aside from that, I just want to be able to call some sort of "forumhome_announcement" template with $announcement in the forumhome template, so I can integrate the announcement title display flawlessly in my Welcome Panel thingie. Basically like in the threadlist. :)
Oh, and I'm running 2.2.6, FYI.
Xenon
08-22-2002, 11:28 PM
insert that in your index.php:
// get announcements
$datenow=time();
$doneannouncements = 0;
if ($announcement=$DB_site->query_first("SELECT announcementid,startdate,title,user.username,user. userid,user.usertitle,user.customtitle
FROM announcement
LEFT JOIN user
ON user.userid=announcement.userid
WHERE startdate<=$datenow AND enddate>=$datenow
AND forumid='-1'
ORDER BY startdate DESC
LIMIT 1")) {
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('forumhome_announcement')."\";");
$doneannouncements = 1;
}
just before this://Forum info
$forums=$DB_site->query('SELECT * FROM forum WHERE displayorder<>0 AND active=1 ORDER BY parentid,displayorder');
while ($forum=$DB_site->fetch_array($forums)) {
$iforumcache["$forum[parentid]"]["$forum[displayorder]"]["$forum[forumid]"] = $forum;
}
$DB_site->free_result($forums);
unset($forum);
as you can see i've just renamed the template names, just create these and style em as you want ;)
you can use $announcement in your forumhome template now ;)
i hope it works, it's not fine but should work ;)
Works! :D Thanks for the fast help, Xenon!
Two questions, though:
a) This will show only global announcements, yes?
b) Shouldn't I add "forumhome_announcement" to $templatesused in index.php? I have no idea what purpose this line serves, just curious.
Xenon
08-22-2002, 11:43 PM
a) i think so ;)
b)yes you should add it to templateused ;)
it'll reduce the ammount of querys ;)
Originally posted by Xenon
it'll reduce the ammount of querys ;)
Great! Thanks again, Xenon! :)
himerus
12-25-2003, 04:21 AM
I'd like to see if anyone has this hack running on Gamma? Could someone post or PM me a link if you do?! TIA!!
MindTrix
12-25-2003, 05:28 AM
Try over at www.vbulletin.nl (http://www.vbulletin.nl) for vB3 hacks. You need to make more than 2 posts, and then wait a hour before you can download over there though.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.