Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 04-11-2001, 04:20 AM
Raptor Raptor is offline
 
Join Date: Nov 2001
Posts: 499
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I saw this on another post (made for v1.1.5)

<?php
require("forum/admin/config.php3");
$db=mysql_connect($servername,$dbusername,$dbpassw ord);
mysql_select_db($dbname);
$query = "SELECT * FROM CATEGORY ORDER BY title ASC";
$resultlatest = mysql_query($query,$db);
while ($latest_array = mysql_fetch_array($resultlatest)) {
echo "<FONT SIZE=\"1\" FACE=\"Verdana\"> °
<A HREF=\"http://digital-forums.com/forum/index.php3?categoryid=$latest_array[categoryid]\">$latest_array[title]</A></FONT><BR>";
}

?>

But I just get this error msg:
Warning: Supplied argument is not a valid MySQL result resource in /home/dforums/public_html/list_categories.php3 on line 7

I'm using v2 beta 5 - can someone please get this working for me

thanks in advance !
Reply With Quote
  #2  
Old 04-11-2001, 04:30 AM
Wayne Luke's Avatar
Wayne Luke Wayne Luke is offline
Senior Member
 
Join Date: Jan 2002
Location: Southern California
Posts: 1,694
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Here this shows the first two levels of forums...

Code:
<?php
require("global.php");
//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)) {
  if ($forum[parentid] == -1) {
    echo ("<font face=\"Arial, Helvetica, sans-serif\" size=\"2\"><b><a href=\"http://sitepointforums.com/forumdisplay.php?forumid=".$forum[forumid]."\">".$forum[title]."</a></b></font><br>");
    if ($forum[allowposting] == 0) {
      $parent=$forum[forumid];
      $subforums=$DB_site->query("SELECT * FROM forum WHERE displayorder<>0 AND active=1 AND parentid=".$parent." ORDER BY displayorder");
      while ($subforum=$DB_site->fetch_array($subforums)) {
        echo ("&nbsp;&nbsp;<font face=\"Arial, Helvetica, sans-serif\" size=\"-3\"><a href=\"http://sitepointforums.com/forumdisplay.php?forumid=".$subforum[forumid]."\">".$subforum[title]."</a></font><br>");
      }
    }
  }
}
$DB_site->free_result($forums);
unset($forum);

?>
Reply With Quote
  #3  
Old 04-11-2001, 05:11 PM
Raptor Raptor is offline
 
Join Date: Nov 2001
Posts: 499
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

this is great thanks

couple of things:

Only works when calling the script when its in the /forum dir. But gives Fatal error: Failed opening required './admin/config.php3' (include_path='.:/usr/local/lib/php') in /home/dforums/public_html/forum/global.php3 on line 49 when outside the forum dir - is this something to do with the chdir command ?

And how to display topics without the sub topics ?

Many thanks
Reply With Quote
  #4  
Old 04-11-2001, 05:17 PM
Raptor Raptor is offline
 
Join Date: Nov 2001
Posts: 499
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ok fixed the first part

chdir("/home/dforums/public_html/forum");
require("global.php3");

now how to list just the topics and not the sub topics - i'll have a go at doing it myself while awaiting help from you guys
Reply With Quote
  #5  
Old 04-11-2001, 05:20 PM
Raptor Raptor is offline
 
Join Date: Nov 2001
Posts: 499
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ok i did it - is the code correct or is there anything in there that doesn't need to be there ?

<?php
chdir("/home/dforums/public_html/forum");
require("global.php3");
//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)) {
if ($forum[parentid] == -1) {
echo ("<font face=\"Verdana\" size=\"2\"><b><a href=\"http://digital-forums.com/forum/forumdisplay.php3?forumid=".$forum[forumid]."\">".$forum[title]."</a></b></font><br>");
if ($forum[allowposting] == 0) {
$parent=$forum[forumid];

}
}
}
$DB_site->free_result($forums);
unset($forum);

?>
Reply With Quote
  #6  
Old 04-11-2001, 05:26 PM
trilizio
Guest
 
Posts: n/a
Default

WITH SUB CATEGORIES
PHP Code:
<?
require("/home/dforums/public_html/forum/global.php");
//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)) {
  if ($forum[parentid] == -1) {
    echo ("<font face=\"Arial, Helvetica, sans-serif\" size=\"2\"><b><a href=\"http://www.yourdomain.com/forum/forumdisplay.php?forumid=".$forum[forumid]."\">".$forum[title]."</a></b></font><br>");
    if ($forum[allowposting] == 0) {
      $parent=$forum[forumid];
      $subforums=$DB_site->query("SELECT * FROM forum WHERE displayorder<>0 AND active=1 AND parentid=".$parent." ORDER BY displayorder");
      while ($subforum=$DB_site->fetch_array($subforums)) {
        echo ("  <font face=\"Arial, Helvetica, sans-serif\" size=\"-3\"><a href=\"http://www.yourdomain.com/forum/forumdisplay.php?forumid=".$subforum[forumid]."\">".$subforum[title]."</a></font><br>");
      }
    }
  }
}
$DB_site->free_result($forums);
unset($forum);

?>
WITHOUT SUB CATEGORIES
PHP Code:
<?
require("/home/dforums/public_html/forum/global.php");
//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)) {
  if ($forum[parentid] == -1) {
    echo ("<font face=\"Arial, Helvetica, sans-serif\" size=\"2\"><b><a href=\"http://www.yourdomain.com/forum/forumdisplay.php?forumid=".$forum[forumid]."\">".$forum[title]."</a></b></font><br>");
}
}
$DB_site->free_result($forums);
unset($forum);

?>
Reply With Quote
  #7  
Old 04-11-2001, 05:27 PM
trilizio
Guest
 
Posts: n/a
Default

Thats should work. If it doesn't then I dunno
Reply With Quote
  #8  
Old 04-11-2001, 07:46 PM
the_sisko's Avatar
the_sisko the_sisko is offline
 
Join Date: Oct 2001
Location: Hamburg,Germany
Posts: 132
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Great
..but it shows my private forums and categories to normal users!!!
Reply With Quote
  #9  
Old 04-11-2001, 09:46 PM
Wayne Luke's Avatar
Wayne Luke Wayne Luke is offline
Senior Member
 
Join Date: Jan 2002
Location: Southern California
Posts: 1,694
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You will have to add a WHERE clause in there to exclude private categories and forums by checking the forums private status.

I have a simple toggle switch in my database called "showactive" if it is true then we show it, if not we don't. The reason for this is we don't want some forums showing up in external scripts even if they are public like General Chit Chat forums and Member only forums.
Reply With Quote
  #10  
Old 04-11-2001, 10:07 PM
Raptor Raptor is offline
 
Join Date: Nov 2001
Posts: 499
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

could you list the code please ?
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 02:31 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.04135 seconds
  • Memory Usage 2,252KB
  • Queries Executed 13 (?)
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
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)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
  • (10)postbit
  • (8)postbit_onlinestatus
  • (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
  • postbit_imicons
  • 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