PDA

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


07 Aug 2000, 00:00
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



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Edit the echo statement as you see fit

~Chris

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

10 Aug 2000, 20:02
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?

10 Aug 2000, 20:08
what about the php code to include on a non vbulletin page ?

10 Aug 2000, 21:32
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

10 Aug 2000, 21:37
thanks gonna try it as soon as i get some sleep first hehe :)

14 Aug 2000, 21:16
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

14 Aug 2000, 21:27
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!

14 Aug 2000, 22:50
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...

14 Aug 2000, 23:30
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 ?

15 Aug 2000, 01:00
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.

15 Aug 2000, 01:17
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... :)

15 Aug 2000, 01:21
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

15 Aug 2000, 01:33
Somewhere in the WHERE clause, add:

AND forumid<>#

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

15 Aug 2000, 01:37
thanks i will give it a try and let you everyone know :D

23 Aug 2000, 11:51
well finally got it to work... http://animeboards.net/forums/showforumlist.php3 thanks :D

01 Sep 2000, 00:07
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.

01 Sep 2000, 03:09
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)

01 Sep 2000, 03:13
Thank you so much,

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

05 Sep 2000, 07:49
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)

05 Sep 2000, 09:01
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,$dbpassword);
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.

05 Sep 2000, 09:53
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


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

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]

05 Sep 2000, 17:19
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.

05 Sep 2000, 17:30
thanks i am learning :D always wondered what categoryid<> meant :D