PDA

View Full Version : [RELEASE] Show category list on non vb pages


08-06-2000, 11:00 PM
Here is another one. This one will display a list of categories on a non vb page;

See it in action here:
http://www.extremeforums.com/include/categorylist.inc.php


<?php
require("/full/path/to/admin/config.php");
$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, Arial, Helvetica, sans-serif\">&nbsp;°
<A HREF=\"http://www.extremeforums.com/forums/index.php?categoryid=$latest_array[categoryid]\">$latest_array[title]</A></FONT><BR>";
}

?>


Edit the echo statement as you see fit

~Chris

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

08-10-2000, 07:02 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:08 PM
what about the php code to include on a non vbulletin page ?

08-10-2000, 08:32 PM
Well assuming you named it "categorylist.inc.php" you would call it like this:

<?php
include("/full/path/to/categorylist.inc.php");
?>

Hope this helps ;)

~Chris

08-10-2000, 08:37 PM
thanks gonna try it as soon as i get some sleep first hehe :)

08-14-2000, 08:16 PM
i tried it and got this error

Fatal error: Failed opening required 'admin/config.php' in /home/usr1/www.animeboards.net/htdocs/forums/categorylist.inc.php on line 2

08-14-2000, 08:27 PM
Fatal error: Failed opening required 'admin/config.php' in
/home/usr1/www.animeboards.net/htdocs/forums/categorylist.inc.php on line 2

You obviously have an error in the path you placed in the include statement. The path would not include the http://www.animeboards.net URL.

Most likely the path is something along the lines of:
/home/usr1/htdocs/forums/categorylist.inc.php

The above path is just a guess based on the error you included!

08-14-2000, 09:50 PM
Nonono.

eva - just try putting in the full absolute path to your config.php. My guess would be at:
/home/usr1/www.animeboards.net/htdocs/forums/admin/config.php

kwakoe - The path in the error is the path of the script that was running, so it HAS to be right, unless eva was using IIS, because that generates some weird error messages occasionally. But that path is Unix...

08-14-2000, 10:30 PM
Originally posted by Ed Sullivan
Nonono.

eva - just try putting in the full absolute path to your config.php. My guess would be at:
/home/usr1/www.animeboards.net/htdocs/forums/admin/config.php

i am on a linux machine....

i put in this

<?php
include("/home/user1/www.animeboards.net/htdocs/forums/categorylist.inc.php");
?>

there's no reference to config in the php code i made on the page... don't know how to :(

here's my url for the categorylist
http://animeboards.net/forums/categorylist.inc.php

how do i hide more than 1 private forum from the list ?

08-15-2000, 12:00 AM
I am installing all of these non-vb page hacks.
Just need the private message and whois online for this...I am working on it, don't know if I will do it.

To you question, to hide more than one private forum I made the private forums the highest forum ids.
Like 25 and 26 then instead of having equals a number I hide it by asking for less than 25.
Do you know what I mean?

It just worked out because I had it this way and it seems to be the easiest way for me.
If I want more private forums later I will just add them after 25 and I will not have a problem.

Hope that helped at all.

Later.

08-15-2000, 12:17 AM
eva - in your inc file, make sure you reference the full path to the config.php, not just admin/config.php

And this doesn't even use forums, so I'm not exactly sure whatcha mean... :)

08-15-2000, 12:21 AM
okay i think forgot to change the path ? ...with forums i was meant to say that for this thread http://www.vbulletin.com/forum/showthread.php?threadid=2283

08-15-2000, 12:33 AM
Somewhere in the WHERE clause, add:

AND forumid<>#

where # is the number of the forum you want to exclude.

08-15-2000, 12:37 AM
thanks i will give it a try and let you everyone know :D

08-23-2000, 10:51 AM
well finally got it to work... http://animeboards.net/forums/showforumlist.php3 thanks :D

08-31-2000, 11:07 PM
What about showing the list on ANOTHER SERVER? :)
it will be great , I'm not an expert but I think this can be done using javascript.

09-01-2000, 02:09 AM
Essam - just replace $servername with "123.456.78.90"

Where 123.456.78.90 is the IP of the server you want to connect to. (Also, note the quotes)

09-01-2000, 02:13 AM
Thank you so much,

This can be done with any hack? like top xxx topics?

09-05-2000, 06:49 AM
Hi!
Can you make a little bit modify to let the result with
how many threads like this:

Category xx (230)
Category yy (300)
Category zz (20)

09-05-2000, 08:01 AM
Originally posted by jameshsi
Hi!
Can you make a little bit modify to let the result with
how many threads like this:

Category xx (230)
Category yy (300)
Category zz (20)

I figure out, and paste here in case someone needs it:
<?php

require("/path/to/your/admin/config.php3");
$db=mysql_connect($servername,$dbusername,$dbpassw ord);
mysql_select_db($dbname);
$query = "SELECT * FROM category ";
$resultlatest = mysql_query($query,$db);
while ($latest_array = mysql_fetch_array($resultlatest)) {
$countid = $latest_array[categoryid] ;
$q1 = "select * from forum where categoryid=$countid";
$howmany = mysql_query($q1,$db);
$counter="0";
while ($count_array = mysql_fetch_array($howmany)) {
$counter = $counter + $count_array[threadcount];
}
echo "<FONT SIZE=\"1\" FACE=\"Arial\">??
<A HREF=\"http://yourdomain/forum/index.php3?categoryid=$latest_array[categoryid]\">$latest_array[title]</A>($counter)</FONT><BR>";
}

?>



Since I am a newbie on PHP coding, please let me know if you know there is a better way to do this.

09-05-2000, 08:53 AM
well that worked but it showed all my private categories as well... since i don't know php i borrowed examples from other code i have copied and did this

<?php

require("/home/usr1/www.animeboards.net/htdocs/forums/admin/config.php");
$db=mysql_connect($servername,$dbusername,$dbpassw ord);
mysql_select_db($dbname);
$query = "SELECT * FROM category where categoryid=1 or categoryid=2 or categoryid=3 or categoryid=4 or categoryid=5 or categoryid=6 or categoryid=7 or categoryid=8 or categoryid=9 or categoryid=10 or categoryid=11 ORDER BY displayorder, title ASC";
$resultlatest = mysql_query($query,$db);
while ($latest_array = mysql_fetch_array($resultlatest)) {
$countid = $latest_array[categoryid] ;
$q1 = "select * from forum where categoryid=$countid";
$howmany = mysql_query($q1,$db);
$counter="0";
while ($count_array = mysql_fetch_array($howmany)) {
$counter = $counter + $count_array[threadcount];
}
echo "<FONT SIZE=\"1\" FACE=\"Arial\"> ?
<A HREF=\"http://animeboards.net/forums/index.php?categoryid=$latest_array[categoryid]\">$latest_array[title]</A> ($counter)</FONT><BR>";
}

?> so i specified each category i wanted to show with 'or categoryid=2' in the query also this displays them in the order you set them in the control panel

i just have no use for displaying this though :(

[Edited by eva2000 on 09-05-2000 at 05:56 AM]

09-05-2000, 04:19 PM
Originally posted by eva2000
well that worked but it showed all my private categories as well... since i don't know php i .....

mysql_select_db($dbname);
$query = "SELECT * FROM category where categoryid=1 or categoryid=2 or categoryid=3 or categoryid=4 or categoryid=5 or categoryid=6 or categoryid=7 or categoryid=8 or categoryid=9 or categoryid=10 or categoryid=11 ORDER BY displayorder, title ASC";
.................]\">$latest_array[title]</A> ($counter)</FONT><BR>";
}

?>[/code] so i specified each category i wanted to show with 'or categoryid=2' in the query also this displays them in the order you set them in the control panel

i just have no use for displaying this though :(

[Edited by eva2000 on 09-05-2000 at 05:56 AM]

You can use :
where categoryid<>'xx'
xx means the categoryid that you don't want to display.

09-05-2000, 04:30 PM
thanks i am learning :D always wondered what categoryid<> meant :D