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 in threads? (https://vborg.vbsupport.ru/showthread.php?t=41282)

X-Fan 07-20-2002 03:31 AM

Announcements in threads?
 
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:
PHP Code:

$threadid intval($threadid);
$thread verifyid("thread",$threadid,1,1); 

add
PHP Code:

$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:

PHP Code:

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


All times are GMT. The time now is 06:49 AM.

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.00951 seconds
  • Memory Usage 1,740KB
  • 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
  • (3)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)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