vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Announcements on Forum Home (https://vborg.vbsupport.ru/showthread.php?t=42633)

Sho 08-22-2002 10:44 PM

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?

Sho 08-22-2002 10:59 PM

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:
PHP Code:

// 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:
PHP Code:

//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 ;)

Sho 08-22-2002 11:37 PM

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 ;)

Sho 08-22-2002 11:46 PM

Quote:

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 for vB3 hacks. You need to make more than 2 posts, and then wait a hour before you can download over there though.


All times are GMT. The time now is 12:10 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01144 seconds
  • Memory Usage 1,744KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete