Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > General > Member Archives
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Details »»

Version: , by (Guest)
Developer Last Online: Jan 1970 Show Printable Version Email this Page

Version: Unknown Rating:
Released: 12-31-2000 Last Update: Never Installs: 0
 
No support by the author.

I asked this a while back, but got no replies. So, I'll ask again...

Can someone please write for me a simple little script that will list (echo or print) a list of all the forums in the message board? Each forum should be listed as a hyperlink to that forum.

For why I need this, please look at my message board: http://www.jjr512.com/bbs/index.php

Notice that at the top of the message board, and on the top of every message board page (forum list, thread list, thread view, etc.) there are hyperlinks into each forum. Many users like to use these, because they can hop around the forums quicker with these than with anything else. I manually created these links, and I'd just like something that will do it automatically, in case my forums change.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 12-31-2000, 08:24 PM
Guest
 
Posts: n/a
Default

There is an hack for that already!

But it displays a small bullet list with all forums in order like A, B, C, D.etc?
Reply With Quote
  #3  
Old 12-31-2000, 08:26 PM
Guest
 
Posts: n/a
Default

That's fine, I can work out the formatting myself, I just need the actual working part to start with. Can you point me in the right direction?
Reply With Quote
  #4  
Old 12-31-2000, 08:41 PM
Guest
 
Posts: n/a
Default

Here it is:

<?php
require("/full/path/to/admin/config.php");
$db=mysql_connect($servername,$dbusername,$dbpassw ord);
mysql_select_db($dbname);
$query = "SELECT * FROM forum ORDER BY title ASC";
$resultlatest = mysql_query($query,$db);
while ($latest_array = mysql_fetch_array($resultlatest)) {
echo "<FONT SIZE=\"1\" FACE=\"Verdana, Arial, Helvetica, sans-serif\">&nbsp;°
<A HREF=\"http://www.extremeforums.com/forums/forumdisplay.php?forumid=$latest_array[forumid]\">$latest_array[title]</A></FONT><BR>";
}

?>
Reply With Quote
  #5  
Old 12-31-2000, 09:00 PM
Guest
 
Posts: n/a
Default

OK, that works. Now, one last question: Can you modify it so that it sorts the forums in the same order that they appear in the message board?
Reply With Quote
  #6  
Old 12-31-2000, 09:01 PM
Guest
 
Posts: n/a
Default

Actually, here's another question: Can we exclude forums that are either really Archives, or else are just closed?
Reply With Quote
  #7  
Old 12-31-2000, 09:12 PM
Guest
 
Posts: n/a
Default

Yeah I am sure you can do those things.
Reply With Quote
  #8  
Old 12-31-2000, 10:22 PM
Guest
 
Posts: n/a
Default

Umm... I meant could somebody show me how?
Reply With Quote
  #9  
Old 12-31-2000, 10:36 PM
Guest
 
Posts: n/a
Default

Here is what I wrote up. It is a little more complicated but is more customizable....

Code:
<?php
require("config.php");
//Changing these flags to Zero will change the output.
$showcat=1;       // Show Categories
$showdesc=1;      // Show Forum Descriptions
$db=mysql_connect($servername,$dbusername,$dbpassword);
mysql_select_db($dbname);
$catquery=("SELECT categoryid,title FROM category WHERE displayorder <> 0 and categoryid<>5 and categoryid<>9 ORDER BY displayorder");
$catresult=mysql_query($catquery,$db);
if ($showcat==1){
  while ($cat = mysql_fetch_array($catresult)) {
    echo ("<font face=\"Arial, Helvetica, sans-serif\" size=\"-1\"><a href=\"http://sitepointforums.com/index.php?categoryid=".$cat[categoryid]."\">".$cat[title]."</a></font><br>");
    $forumquery=("SELECT forumid,title,description FROM forum WHERE showactive=1 and categoryid=$cat[categoryid] ORDER BY displayorder");
    $forumresult=mysql_query($forumquery,$db);
    while ($forum = mysql_fetch_array($forumresult)) {
      if ($showdesc==1) {
        echo ("<font face=\"Arial, Helvetica, sans-serif\" size=\"-3\"><a href=\"http://sitepointforums.com/forumdisplay.php?forum=".$forum[forumid]."\">".$forum[title]."</a><br>".$forum[description]."</font><br>");
      }
      else {
        echo ("<font face=\"Arial, Helvetica, sans-serif\" size=\"-3\"><a href=\"http://sitepointforums.com/forumdisplay.php?forum=".$forum[forumid]."\">".$forum[title]."</a></font><br>");
      }
    }
  }
}
else {
  $forumquery=("SELECT forumid,title,description FROM forum WHERE showactive=1 ORDER BY displayorder");
  $forumresult=mysql_query($forumquery,$db);
  while ($forum = mysql_fetch_array($forumresult)) {
    if ($showdesc==1) {
      echo ("<font face=\"Arial, Helvetica, sans-serif\" size=\"-3\"><a href=\"http://sitepointforums.com/forumdisplay.php?forum=".$forum[forumid]."\">".$forum[title]."</a><br>".$forum[description]."</font><br>");
    }
    else {
      echo ("<font face=\"Arial, Helvetica, sans-serif\" size=\"-3\"><a href=\"http://sitepointforums.com/forumdisplay.php?forum=".$forum[forumid]."\">".$forum[title]."</a></font><br>");
    }
  }
}
?>
This code requires a custom field to be added to your Forum table... It should be:
showactive smallint(6) default 1

setting that column to zero will prevent particular forums from showing. Also if you want to exclude different categories then you can change the line:
Code:
$catquery=("SELECT categoryid,title FROM category WHERE displayorder <> 0 and categoryid<>5 and categoryid<>9 ORDER BY displayorder");
To reflect your restricted categories.
Reply With Quote
  #10  
Old 01-01-2001, 02:33 AM
Guest
 
Posts: n/a
Default

Hmm... I thought the solution would involve something similar to this piece of code:
Code:
$querylatest="SELECT * FROM thread WHERE forumid='1' OR forumid='2' OR forumid='3' OR forumid='4' OR forumid='5' OR forumid='6' OR forumid='8' OR forumid='11' OR forumid='12' OR forumid='13' ORDER BY lastpost DESC LIMIT $num_active";
That selects which forums to include (taken from the active topics hack). Now, I don't remember the exact syntax, but I thought there was a way to have a similar statement, only instead of explicitly specifying which forums to select, it could be written to select all forums except private ones. Well, I'd like to include private forums, but I thought that it could be modified so that it selected all forums except those that are off.

(I'm trying to avoid modifying the database, I haven't even backed it up yet and don't know how, and I'm uncomfortable messing with it. Besides, I think there must be a more elegant solution.)
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:52 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.04091 seconds
  • Memory Usage 2,270KB
  • Queries Executed 23 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (3)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete