PDA

View Full Version : [RELEASE] Show forum list on non vb page


08-06-2000, 10:55 PM
Hey everyone,
Ive been wanting this and noone ever created it so I thru one together. You can see it in action here:
http://www.extremeforums.com/include/forumlist.inc.php

Here is the code:
[code]
<?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>";
}

?>
[code]

You will need to edit the echo statement to reflect your site.

Hope someone will use this

~Chris



[Edited by TechTalk on 08-10-2000 at 05:34 PM]

08-06-2000, 11:10 PM
Or if you only wanted to display your more popular forums you could change the $query line to something like this:


$query = "SELECT * FROM forum WHERE threadcount > 50 ORDER BY title ASC";


That will show only a list of forums with more than 50 threads. This is good if you have alot of forums and dont want to display them all on the homepage

~Chris

08-07-2000, 12:47 AM
Since it looks as though some people are checking this one out ill add this. If you dont want to display a private forum in the list then try something like this:


$query = "SELECT * FROM forum WHERE threadcount > 50 AND forumid != 34 ORDER BY title ASC";


"34" would actually be the forum id of your particular private forum. If someone knows of a more efficiant way of doing this please let me know

~Chris

08-10-2000, 07:01 PM
What code does one use to include this inside a vBulletin template. Such as a footer or header file?

How do you use this inside in vBulletin page?

08-10-2000, 07:09 PM
i'll ask again.. what about php include code to a non vbulletin page ?

08-10-2000, 07:13 PM
Originally posted by TechTalk
Since it looks as though some people are checking this one out ill add this. If you dont want to display a private forum in the list then try something like this:


$query = "SELECT * FROM forum WHERE threadcount > 50 AND forumid != 34 ORDER BY title ASC";


"34" would actually be the forum id of your particular private forum. If someone knows of a more efficiant way of doing this please let me know

~Chris



what about if you want to show all forums but the private ones, but do not want to only list the popular ones ?

08-10-2000, 07:22 PM
okay i think most people have their config.php file in their admin directory and not vb forum directory so "admin/config.php" instead of "config.php" in both threads right :)

i did it at http://animeboards.net/forums/forumlist.inc.php so how does one include it into a non vbulletin page... i.e. front page at http://animeboards.net ?

also is there any way to order them other than alphabetically ?

08-10-2000, 07:46 PM
Just use an include statement on the page at the location that you want to display it.

As long as the page has one of the following extensions which must be recognized by your server: .phtml .php .php3

08-10-2000, 07:54 PM
eva you could do:


order by categoryid, displayorder


that will order the forums firstly into the category they belong, then in the order that you have set the forums to display within their category.

08-10-2000, 08:00 PM
Does anyone know how to display these code hacks inside a vB template such as a header or footer file? I do not think you can include actual php code inside the templates. The code does not get parsed. What is the mechanism and/or code and how can this be setup?

I am referring to:
show forumlist
show categorylist

etc......

08-10-2000, 08:20 PM
Originally posted by rangersfan
eva you could do:


order by categoryid, displayorder


that will order the forums firstly into the category they belong, then in the order that you have set the forums to display within their category. ah yes, that's what i am looking for :D

so what's the include command to do it say on my front non vb page ?

is it

<?php
include ("fileurl");
?>

did i get that right ?

09-15-2000, 01:43 PM
using this code
<?php

$db=mysql_connect($servername,$dbusername,$dbpassw ord);
mysql_select_db($dbname);
$query = "SELECT * FROM forum WHERE threadcount > 1 AND forumid != 21 AND forumid != 22 AND forumid != 23 AND forumid != 28 AND forumid != 24 AND forumid != 7 AND forumid != 13 AND forumid != 32 AND forumid != 34 AND forumid != 37 AND forumid != 5 AND forumid != 6 AND forumid != 33 AND forumid != 15 AND forumid != 42 ORDER BY categoryid, displayorder, 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://animeboards.net/forums/forumdisplay.php?forumid=$latest_array[forumid]\">$latest_array[title]</A></FONT><BR>";
}

?>
on my frontpage at http://animeboards.net i added 4 new forums of which id = 42 is private

The above code hides the forum correctly, but it doesn't show my 3 other new forums id = 44, 45, 46 ?

i just upgraded to php4.02/zend

any ideas ?

09-15-2000, 08:10 PM
Originally posted by eva2000
using this code
<?php

$db=mysql_connect($servername,$dbusername,$dbpassw ord);
mysql_select_db($dbname);
$query = "SELECT * FROM forum WHERE threadcount > 1 AND forumid != 21 AND forumid != 22 AND forumid != 23 AND forumid != 28 AND forumid != 24 AND forumid != 7 AND forumid != 13 AND forumid != 32 AND forumid != 34 AND forumid != 37 AND forumid != 5 AND forumid != 6 AND forumid != 33 AND forumid != 15 AND forumid != 42 ORDER BY categoryid, displayorder, 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://animeboards.net/forums/forumdisplay.php?forumid=$latest_array[forumid]\">$latest_array[title]</A></FONT><BR>";
}

?>
on my frontpage at http://animeboards.net i added 4 new forums of which id = 42 is private

The above code hides the forum correctly, but it doesn't show my 3 other new forums id = 44, 45, 46 ?

i just upgraded to php4.02/zend

any ideas ?

First use <> instead of != and also you have a clause in there "threadcount > 1 " are you sure the new forums have at least one thread in them? If nto they wont show ;)

~Chris

09-15-2000, 08:21 PM
thanks techtalk for coming to my rescue again :D

hehe yeah the forums didn't have any posts... and the coding mistakes are from me just cut and pasting code from different stuff you guys posted and hoping it would work :)

now i have to find that submit button.... where is it.. ***scrolls horizontal half way across the screen ****

09-15-2000, 08:30 PM
Originally posted by eva2000
thanks techtalk for coming to my rescue again :D

hehe yeah the forums didn't have any posts... and the coding mistakes are from me just cut and pasting code from different stuff you guys posted and hoping it would work :)

now i have to find that submit button.... where is it.. ***scrolls horizontal half way across the screen ****

Glad I could help ;)

As far as the coding.....both ways will work..but I have recently found that <> is more compatible on different systems with different configurations ;)

~Chris

BabyU
02-15-2002, 07:27 PM
This hack no longer seems to work with the newer versions of VB. I used it several versions ago and it worked great ... but now I get the following error:

Warning: Supplied argument is not a valid MySQL result resource in /usr/home/babyu/htdocs/forums/categorylist.php on line 7

Best I can figure it is referring to:

while ($latest_array = mysql_fetch_array($resultlatest)) {

Any ideas?

sabret00the
02-19-2003, 03:47 PM
does this still work, i got 4 private forums so i'm assuming it would be


<?php

$db=mysql_connect($servername,$dbusername,$dbpassw ord);
mysql_select_db($dbname);
$query = "SELECT * FROM forum WHERE threadcount > 0 AND forumid != 16 AND forumid != 17 AND forumid != 18 AND forumid != 20 ORDER BY categoryid, displayorder, title ASC";
$resultlatest = mysql_query($query,$db);
while ($latest_array = mysql_fetch_array($resultlatest)) {
echo "<FONT SIZE=\"1\" FACE=\"Tahoma, Verdana, Arial, Helvetica, sans-serif\"> ?
<A HREF=\"http://www.ebslive.com/forums/forumdisplay.php?forumid=$latest_array[forumid]\">$latest_array[title]</A></FONT><BR>";
}

?>

sabret00the
02-27-2003, 11:36 AM
<?php

$db=mysql_connect($servername,$dbusername,$dbpassw ord);
mysql_select_db($dbname);
$query = "SELECT * FROM forum WHERE threadcount > 0 AND forumid != 16 AND forumid != 17 AND forumid != 18 AND forumid != 20 ORDER BY categoryid, displayorder, title ASC";
$resultlatest = mysql_query($query,$db);
while ($latest_array = mysql_fetch_array($resultlatest)) {
echo "<FONT SIZE=\"1\" FACE=\"Tahoma, Verdana, Arial, Helvetica, sans-serif\"> ?
<A HREF=\"http://www.ebslive.com/forums/forumdisplay.php?forumid=$latest_array[forumid]\">$latest_array[title]</A></FONT><BR>";
}

?>


i seem to be getting an error on the line while ($latest_array = mysql_fetch_array($resultlatest)) { help :nervous: