PDA

View Full Version : Sub-Forums


09-19-2001, 10:00 PM
I updated the hack a little so it looks nice.

http://vbulletin.com/forum/showthread.php?s=&postid=173883&t=272#post173883

Credit To: ethank

Added:

Display order, so it orders the sub-forums the way they are listed in your admin CP.

Added an hr.

Thats it it!

if you watn the HR to look good add this into your
"Custom replacements"

hr is replaced by <hr size="1" color="{ tablebordercolor }"

{ tablebordercolor } - dont forget to remove the spaces "{ }

that is it!

valid
09-20-2001, 01:29 AM
Demo

Kajiro
09-20-2001, 07:33 AM
thx valid~ Nice Work!!:D
but when i add SIZE code in the HR .. get Error~
anyway... this is very useful~

Goldfinger
09-20-2001, 07:55 AM
try putting a \ before any " on your size

like.. <hr size=\"1\">

Juan
09-20-2001, 08:27 AM
This hack is very cool. Can it be done with the forums in a category?

mbombd
09-20-2001, 09:06 AM
great hack, i was lookin' for this, thx :)

ethank
09-20-2001, 02:55 PM
Awww, you made it perty! :)

I'll put the update on my code.

Ethan

floleb7
09-20-2001, 06:29 PM
does this can be done for index ?

valid
09-20-2001, 06:51 PM
Originally posted by floleb7
does this can be done for index ?

Yes this way, take a look!

cyrus
09-20-2001, 07:50 PM
EXCELLENT

and so amazingly easy to add !!

* pats VALId on back* :)

Bender
09-20-2001, 07:55 PM
Great Hack, valid - easy to implement and works like a charm :D

Kajiro
09-20-2001, 11:42 PM
Originally posted by Goldfinger
try putting a \ before any " on your size

like.. <hr size=\"1\">

woo~ this can fix my problem~~
thx Q very MUCH ;)

DarkReaper
09-20-2001, 11:50 PM
Right...this didn't work for me. Do forums have to have a description for this to work? Lots of my forums don't have descriptions....

Also, how would I get it so it only shows the total threads/replies for all the subforums added up, but not the subforums themselves?

valid
09-21-2001, 02:47 AM
here, look at this screenshot!

Thats how you do it!

Originally posted by DarkReaper
Right...this didn't work for me. Do forums have to have a description for this to work? Lots of my forums don't have descriptions....

Also, how would I get it so it only shows the total threads/replies for all the subforums added up, but not the subforums themselves?

valid
09-21-2001, 02:54 AM
still works!

as you can see in the txt file, you need to mod 2 files, not just index.php

index.php and forumdisplay.php

JJR512
09-21-2001, 08:06 AM
A very very trivial matter...but for the sake of making the subforum links exactly identical to the regular forum links, I changed the line that starts with $subs.= so that the forumid number and sessionhash were reversed. The stock vB has the sessionhash in the link first, followed by the forum specification...in this hack, it's backwards. As I said, it's trivial, I'm sure it makes no difference; I just like to have things looking the same, that's all.

$subs.="<a href=\"forumdisplay.php?s=$session[sessionhash]&forumid=$forum_child[forumid]\">$forum_child[title]</a>";

DarkReaper
09-21-2001, 10:52 AM
I have forums that have subforums. They go 5 levels deep. I modified both files. It doesn't work.

valid
09-21-2001, 11:08 AM
Than I dont know whats wrong, : P (sorry), should have worked with ease, maybe you have some other hacks runing that prevent it from displaying or you installed it wrong, who knows, I'm very limited in php codeing.

So this hack is not suppored, just trying to help the best way I can, and I didnt write it "ethank" did, I only mod it a little to give it a better look and display order of the forums, thats all.

: P

Originally posted by DarkReaper
I have forums that have subforums. They go 5 levels deep. I modified both files. It doesn't work.

Goldfinger
09-21-2001, 11:12 AM
Valid on your board how'd you do the auto post.. thats real cool. share :).

valid
09-21-2001, 06:58 PM
Go to dev forum and then to vbulletin hacks section on that forum! : P

JJR512
09-22-2001, 05:14 AM
I'm wondering if there can be some way to indicate on the main page if the subforums have new posts. In a main forum, where you have the subforums listed below it (under an hr), I'm thinking of some kind of little indicator, about the same size as the smallfont text. I guess we would have to have two new graphics, one to indicate on and one to indicate off, but could you write into your hack the code to make it light up appropriately?

DarkReaper
09-22-2001, 04:31 PM
Originally posted by JJR512
I'm wondering if there can be some way to indicate on the main page if the subforums have new posts. In a main forum, where you have the subforums listed below it (under an hr), I'm thinking of some kind of little indicator, about the same size as the smallfont text. I guess we would have to have two new graphics, one to indicate on and one to indicate off, but could you write into your hack the code to make it light up appropriately?

I've been wanting that as well...but I'd also like to have it add up the thread and reply count for all the sub-forums and show that too...as well as the last posted date, etc...

\/ash
09-23-2001, 05:13 AM
damn tom. your so elite =]

ethank
09-23-2001, 05:21 AM
Originally posted by JJR512
I'm wondering if there can be some way to indicate on the main page if the subforums have new posts. In a main forum, where you have the subforums listed below it (under an hr), I'm thinking of some kind of little indicator, about the same size as the smallfont text. I guess we would have to have two new graphics, one to indicate on and one to indicate off, but could you write into your hack the code to make it light up appropriately?

Its possible, but a bit query intensive in my case cause of the markread table. Also it might be a bit cluttered.

Ethan

valid
09-23-2001, 05:46 AM
ethank is right : P

Nice idea but in my case, I have lots of subforums, it would get cluttered as ethank said, haveing like 6 or less, its a good idea, bad idea for like 11 and up, and if you have like 1000+ members and all of them post in the subforums all the subforums would have a gif/jpg indicator that theres new post, and that would use up too much forum space, if you dont mind scrolling and scrolling all the time to get to a forum on index.php, lol, you get the idea.

JJR512
09-23-2001, 08:25 AM
I only meant a small little gif, like maybe a little dot or something...but OK. How about this then: Have the link to the subforum be one color if it has new posts, be another color if it doesn't? Or something along those lines.

DarkReaper
09-23-2001, 03:20 PM
I think you're missing the point. The graphic itself isn't the problem, but the fact that a lot more queries are nessesary to check for new posts throughout an entire forum hierarchy is excess load.

valid
09-23-2001, 04:00 PM
what Dark said! : P

hehe was going to say that but didnt know how, me = limited in php.

Originally posted by DarkReaper
I think you're missing the point. The graphic itself isn't the problem, but the fact that a lot more queries are nessesary to check for new posts throughout an entire forum hierarchy is excess load.

magistr
09-24-2001, 09:00 AM
Valid!

please
send me url your screeshot
this style very cool and i want have this style board
http://vbulletin.com/forum/attachment.php?s=&postid=173889

YourHostSucks
09-27-2001, 07:05 PM
I love it! :)

Thanks!

Axelon
09-27-2001, 08:38 PM
i don't see the subforum...

i have only the write :

subforum:



:( :( :(

Kengan
10-02-2001, 04:35 AM
Nice Hack !! ;)

hacker
10-02-2001, 06:05 AM
One of the simplest and yet very elegant hack!!

BTW, I don't understand this. Can someone explain it to me?

if you watn the HR to look good add this into your
"Custom replacements"

hr is replaced by <hr size="1" color="{ tablebordercolor }"

{ tablebordercolor } - dont forget to remove the spaces "{ }

YourHostSucks
10-02-2001, 06:28 AM
<hr size="1" color="{ tablebordercolor } ">

take out the space after { and before }

Will make you hr line size"1" (nice and small)
and color will be your styles color for the table border...

hacker
10-02-2001, 06:31 AM
Where do I find this line of code?

YourHostSucks
10-02-2001, 06:44 AM
I am going to assume you already installed this hack...

So, open index.php and forumdisplay.php

Search For:

$forum['description'] .= "<hr><B>Sub-Forums:</B> ";

Replace With:

$forum['description'] .= "<hr size="1" color="{ tablebordercolor } "><B>Sub-Forums:</B> ";

But take out the space after { and before } around tablebordercolor.

hacker
10-02-2001, 09:13 AM
Thanks for your help.

Only thing now: Whenever I replace the code that you gave me, I get an error message:

Parse error: parse error in /home/public_html/forums/index.php on line 291

hacker
10-02-2001, 09:20 AM
$forum['description'] .= "<hr><B>Sub-Forums:</B> ";

Replace With:

PHP:

$forum['description'] .= "<hr size="1" color="#555576 "><B>Sub-Forums:</B> ";

I just can't seem to get past the error.

mister
10-02-2001, 12:55 PM
you need to escape your quotes.

put a \ before any " inside your string.

your code should be:

$forum['description'] .= "<hr size=\"1\" color=\"#555576\"><B>Sub-Forums:</B> ";

hacker
10-02-2001, 01:05 PM
Thanks a million. The escape characters really helped! Thank you thank you thank you!!!:p

YourHostSucks
10-02-2001, 04:02 PM
Sorry hacker,


I waited like 10 min's to seee if you would reply..
But you did not so I figure it all went well, and went to bed. :)

But you could also just remove the "

Code off my fourmdisplay.php:
$forum['description'] .= "<hr size=1 color={ tablebordercolor }><B>Sub-Forums:</B>";

I was very sleepy when I posted that, but if I was still up
would have helped.. sorry (hehe)

hacker
10-02-2001, 11:32 PM
Thank you, I had to leave for an appointment :).

Afterburner
10-03-2001, 08:30 AM
thx for this nice hack

hacker
10-04-2001, 01:53 AM
Thanks again. This makes navigation so much simpler!

halo1
10-05-2001, 12:59 PM
NP, I'm NanoEntity, pritty neat hack if you ask me! : P

all you have to do is add a replacemnet var

<hr

replaced by

<hr size="1" color="{ tablebordercolor }"

this will look all over your forum hor <hr and replace it with size 1 and border color.

make is look nice all over your forum.

h4p3
11-01-2001, 08:11 AM
Does anybody know, if this still works with 2.2.0?

Regards,
h4p3

Hotte
11-01-2001, 09:55 AM
Sorry, but this hack generates too much queries.

MrLister
11-01-2001, 01:46 PM
most likely
Originally posted by h4p3
Does anybody know, if this still works with 2.2.0?

Regards,
h4p3

TigerLily
11-01-2001, 02:24 PM
This hack is great! I've been hardcoding that stuff forever on my forums (I have close to 100 boards, and can't even think of putting them all on the main page!) Thanks for doing this, it will definitely make things a lot easier to manage!
Kim:)

PS Just read the remark about it generating a lot of queries- anyone finding that it bogs down your server? If so, I may have to continue to hard code, but nice to know that there is an alternative!

danielillo
11-28-2001, 10:57 PM
Is there any way to show "Sub-Forums:" in RED and the Sub-forums in BOLD ?


Thanks and excuse my english (I put the colours to show you how I would like it to appear).

Kengan
11-28-2001, 11:06 PM
That is rocks hack !! thanks !

Princeton
11-29-2001, 01:56 AM
Originally posted by danielillo
Is there any way to show "Sub-Forums:" in RED and the Sub-forums in BOLD ?


Thanks and excuse my english (I put the colours to show you how I would like it to appear). Look for this code ...$forum['description'] .= "<hr><B>Sub-Forums:</B> "; and replace it with this:$forum['description'] .= "<hr><B><font color=\"#FE1B01\">Sub-Forums:</font></B> ";

Princeton
11-29-2001, 01:57 AM
This hack doesn't work with forums that are under moderation (posts have to be validated). Is there a fix to this somewhere?UPDATED: FIXED

george_proost
12-02-2001, 07:33 PM
?0.02

I used the basis of the hack. Modified extremely... and works great. Does not generate many extra queries, and is damn fast.

Features added :
- Bold on new messages
- custom forum type
- variable number of columns to display per parents children

added 2 fields to forum table showas and numcols
this is the index.php version. For the forumdisplay.php
there is some stuff to comment out ( or in) dependeing on your requirements (sorts out spacing before and after subforum lists)

See it in action at www.mainframeforum.com

here is the code, I do not support it, have fun .....

// ************************************************** ******************
// ADDED BY ERK
// ************************************************** ******************
$subforums=$DB_site->query("select title,forumid,lastpost,replycount,threadcount,show as,numcols from forum where parentid = $forum[forumid] and active != 0 ORDER BY parentid,displayorder");
if ($DB_site->num_rows($subforums)>0)
{
$subs = "<smallfont><table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" align=\"center\" id=\"ltlink\" ><tr valign=\"top\"> ";

$num_cols = $forum[numcols];
$col_width = floor(100/$num_cols);
$num_rows = ceil($DB_site->num_rows($subforums)/$num_cols);
$cur_col = 0;
$cur_row = 1;

while ($forum_child=$DB_site->fetch_array($subforums))
{
$permission=$DB_site->query_first("select accessmask from access where userid = $bbuserinfo[userid] AND forumid = $forum_child[forumid]");
if ($permission['accessmask'] != 0 || $permission['accessmask'] == null)
{
// ------------------------------
// check new messages in subforum
// and set 'bolding' attributes
// ------------------------------
$bold_on = "";
$bold_off = "";
if ($bbuserinfo['lastvisitdate']=='Never') {
$bold_on = "<b>";
$bold_off = "</b>";
} else {
if (isset($bbforumview[$forum_child['forumid']]) and $bbforumview[$forum_child['forumid']]>$bbuserinfo['lastvisit']) { $userlastvisit=$bbforumview[$forum_child['forumid']];
} else {
$userlastvisit=$bbuserinfo['lastvisit'];
}
if ($userlastvisit<$forum_child['lastpost']) {
$bold_on = "<b>";
$bold_off = "</b>";
} else {
$bold_on = "";
$bold_off = "";
}
}

if ($cur_row == 1)
{
$subs.="<td width=\"$col_width%\">";

$cur_col++;
}
$subs.="<table cellspacing=\"0\" cellpadding=\"1\" border=\"0\" width=\"100%\"><tr valign=\"top\" ><td nowrap><font class=\"sf\">- </td><td width=\"100%\">";
$subs.="<a href=\"$bburl/f$forum_child[forumid]/s\">";
$child_text = "$bold_on$forum_child[title]$bold_off&nbsp;";

// switch on showas
switch ($forum_child[showas])
{
// FULL AFFILIATES
case "AFF":
$subs.="<font class=\"sf\" color=\"darkblue\">$child_text</font></a><img src=\"$bburl/images/star.gif\">";
break;
case "AFF_AS":
$subs.="<font class=\"sf\" color=\"white\">$child_text</font></a><img src=\"$bburl/images/star.gif\">";
break;
// VENDOR MODERATED
case "VEN":
$subs.="<font class=\"sf\" color=\"black\">$child_text</font></a><img src=\"$bburl/images/posticonnew.gif\">";
break;
// CONTRIBUTOR MODERATED
case "CON":
$subs.="<font class=\"sf\" color=\"darkgreen\">$child_text</font></a><img src=\"$bburl/images/paperclip.gif\">";
break;
// USENET FORUM ENTRIES
case "USE":
$subs.="<font class=\"sf\" color=\"brown\">$child_text</font></a><img src=\"$bburl/images/posticon.gif\">";
break;
// MEMBER MODERATED
case "MEM":
$subs.="<font class=\"sf\" color=\"darkorange\">$child_text</font></a>";
break;
// HIDDEN
case "LOW":
$subs.="<font class=\"sf\" color=\"#999999\">$child_text</font></a>";
break;
// DEFAULT
default:
// -------------------------------
// set entry to italic if no posts
// -------------------------------
// if ($forum_child[threadcount] == 0 ){
// $subs.="<font class=\"sf\" color=\"black\"><i>$child_text</i></font></a>";
// } else {
$subs.="<font class=\"sf\" color=\"black\">$child_text</font></a>";
// }
break;
} // end switch

// ---------------------
// tag on the replycount
// ---------------------
// if ($forum_child[threadcount] > 0 ){
// $subs.="<font class=\"sf\" color=\"#999999\">&nbsp;&nbsp;<i>Posts($forum_child[replycount])</i></font>";
// }

// ---------------------------------------
// check if i need to go to new column yet
// ---------------------------------------
if ($cur_row == $num_rows) {
$cur_row=1; $subs.= "</td></tr></table></td>";
}
else {
$cur_row++;
$subs.="</td></tr></table>";
}

} // end-if
} // end-while

// -------------------------------------
// close off the remaining empty columns
// and finish off the table etc..
// -------------------------------------
$todo_cols = $num_cols - $cur_col;
while ($todo_cols != 0)
{
$subs.="<td width=\"$col_width%\"></td>" ;
$todo_cols--;
}
$subs.="</tr></table></smallfont>";

if ($forum['description'] != '') {
$forum['description'].= "<br><br>$subs<br>";
}
else {
$forum['description'].= "<br>$subs"; // used in index.php
// $forum['description'].= "<br>$subs<br>"; // used in forumdisplay.php
}

$subs=null;
} // end-if
else {

if ($forum['description'] != '') {
// $forum['description'].= "<br><br>"; // used in forumdisplay.php
}
else {
// $forum['description'].= "<br>"; // used in forumdisplay.php
}

}

$DB_site->free_result($subforums);
$forum_child=null;

// ************************************************** ******************
// END ADDED
// ************************************************** ******************

DarkReaper
12-03-2001, 03:25 AM
I just want to show the forums that have subforums, but no posts themselves, and therefore don't show up as anything but the name of the ategory on the main index page....I want to have the reply count and post count for those shown on the main forum page like other normal forums are. How can I do this the best way, with the fewest queries?

xgamer
12-05-2001, 03:04 PM
cool hack and is very easy to install

philphee
12-06-2001, 05:00 AM
Works like a charm, thx for the great hack!

RobAC
12-08-2001, 07:33 PM
Is there a way to exclude certain subforums from showing up such as private forums?

ixian
12-13-2001, 09:03 PM
Nice hack! I have it working at my site.

Question - Currently, I can't get subforums to show up under CATAGORIES, only other forums. To get around this, I made my Catagories forums, then locked them for new posts so no one would post in them. This works fine, however, that also makes the "Locked" icon appear next to them.

Any way to change the locked icon to active/inactive again even if the main forum is locked but the subforums are not? I've had several users complain that they used to pay attention to the active/inactive icons (never knew that, I don't, but hey).

Sven
01-16-2002, 08:22 PM
Very nice hack ;)

But I think there's a little glitch if a subforum has subforums.
The subforums of subforum are displayed this way

subforum
subforums: x, y
x
y

Is there a way to prevent it?

See attachment:

Psychdrone
02-13-2002, 10:44 PM
NO offence but this hack sucks,

Everyone so that your aware, it adds a query for every subforum that you have, so watch out!

tamarian
02-19-2002, 04:56 PM
Yes, if you have many subforums, this hack can be very expensive (100+ queries).

However, you can easily optimize it.

I deleted this portion:

$permission=$DB_site->query_first("select accessmask from access where userid = $bbuserinfo[userid] AND forumid = $forum_child[forumid]");
if ($permission['acessmask'] != 0 || $permission['accessmask'] == null)
{

And the matching "}"

This will reduce the queries to only the number of main forums you have (mine went down from 130 to 40)

Warning To use this optimization, make sure you have no hidden/private sub-forums that reside under public forums.

Jonathan
03-24-2002, 11:22 PM
PLEASE HELP! URGENT!

After installing the hack I get this error:

Parse error: parse error in /var/www/html/forumdisplay.php on line 401

These are what the lines read:

400 - $limitlower=($pagenumber-1)*$perpage+1;
401 - $limitupper=($pagenumber)*$perp

and 401 is the last line on mine, what's wrong?

PLEASE HELP, IT'S VERY URGENT!

eGoR
04-08-2002, 04:38 PM
amazing work on this code
thx alot :P

Corbu
05-07-2002, 09:28 AM
I link soo much this hacks !

I'have a request. It works on vb 2.2.5. I install it and it looks : screenshot at the end of the post.

I'll try to made a better design of this by remplacing the code of the hack by this on forumdisplay.php :
// ADDED BY ERK
if ($forum[cancontainthreads]!=0)
{

$subforums=$DB_site->query("select title,forumid from forum where parentid = $forum[forumid] and active != 0 ORDER BY parentid,displayorder");
if ($DB_site->num_rows($subforums)>0)
{
$forum['description'] .= "<hr><B>Sous-forums:</B> ";
}
$i = 0;
while ($forum_child=$DB_site->fetch_array($subforums))
{
$i++;
$permission=$DB_site->query_first("select accessmask from access where userid = $bbuserinfo[userid] AND forumid = $forum_child[forumid]");
if ($permission['acessmask'] != 0 || $permission['accessmask'] == null)
{
$subs.="<a href=\"forumdisplay.php?forumid=$forum_child[forumid]&s=$session[sessionhash]\"><li>$forum_child[title]</li></a>";
if ($i < $DB_site->num_rows($subforums))
{
$subs.="";
}
}
}
$DB_site->free_result($subforums);
$forum_child=null;
$forum['description'].= $subs;
$subs=null;
}
// END ADDED


But now...I have a big request :

I wanted to make the button at the left of the name of the sub-forum as an indicator gif button such as the same of when there is a new message on the forums. To know witch sub-forum as new messages...

Do you understand my request ? I'm sorry for my english...

Thank you.

FCorner
05-22-2002, 11:23 AM
This is totally cool! Thank you! :-D

jbell
05-31-2002, 11:29 PM
Originally posted by valid
I updated the hack a little so it looks nice.

http://vbulletin.com/forum/showthread.php?s=&postid=173883&t=272#post173883


why can't I access that link?


:

You do not have permission to access this page. This could be due to one of several reasons:

If you are a registered member and a vBulletin customer, please add your username to this form to be able to access certain resticted areas on this site!

You do not have permission to access the page that you were trying to. Are you trying to edit someone else's post or trying to access administrative features? Check that you are allowed to perform this action in the Forum Rules.
If you are trying to post, the administrator may have disabled your account, or it may be awaiting activation.

Jack Jensen
06-20-2002, 04:51 PM
"Very nice hack

But I think there's a little glitch if a subforum has subforums.
The subforums of subforum are displayed this way

subforum
subforums: x, y
x
y

Is there a way to prevent it?"

Yea I have the same question/problem. If there is a way to NOT show the sub-forums under the hacked sub-forums when you're in the thread, this would be perfect. :D

Can it be done?

Massiel
08-17-2002, 11:16 PM
Very kewl, was looking for this!!!

Cold Steel
09-17-2002, 11:59 AM
Great hack, have had it installed for awhile.

But how come it doesn't show up in the hack database?

Feanor
09-17-2002, 08:52 PM
Works great, thank you :)

Jeremy B
10-28-2002, 08:01 PM
GRRR can't access the link and I AM registered on vbulletin.com with their support. :disappointed: :disappointed:

Erwin
10-28-2002, 08:15 PM
Use this link - that link is wrong as it's old:

https://vborg.vbsupport.ru/showthread.php?s=&postid=173883&t=272

Ninth Dimension
11-17-2002, 06:53 PM
nice hack
/me clicks install

KingsGambit
12-11-2002, 10:59 PM
This is a fantastic hack, thanks for this. I've tweaked it a little for myself but it makes a great difference. Accessing all forums from the main page is a great addition to a forum. :)

TLfuRy
12-20-2002, 01:21 PM
Anyone tested this on 2.2.9 yet? I had it working on earlier versions, but when when I add the code I get errors. :(

TLfuRy
12-20-2002, 09:29 PM
Weird, I just did it again and it worked fine.

Uhh...SWEET! :D

speedway
12-20-2002, 11:50 PM
Anyone tested this on 2.2.9 yet?

Yup, running on 2.2.9 test forum now - works fine. What problems are you having?

Brain Crusher
02-12-2003, 10:09 PM
Question, if i have a board
like

1) music
2) dvd
3) xxx

and add a subforums in music like
1) music --> vinyls
2) music --> cds
3) music --> upcoming

Now i want make show subforums from cds in the index, i will use this hack but a big question, i want make cd´s to onlay a forumcategory, which should only show the subforums...if i now click the options not open for new postings, the cds subforum is closed, and if i post new postings in a subforum of cds, the index will not show this, any guy know a trick for me? I read the subforum with a new posting, will be bold text...

Brain Crusher
02-12-2003, 10:23 PM
Originally posted by ixian
Nice hack! I have it working at my site.

Question - Currently, I can't get subforums to show up under CATAGORIES, only other forums. To get around this, I made my Catagories forums, then locked them for new posts so no one would post in them. This works fine, however, that also makes the "Locked" icon appear next to them.

Any way to change the locked icon to active/inactive again even if the main forum is locked but the subforums are not? I've had several users complain that they used to pay attention to the active/inactive icons (never knew that, I don't, but hey).

same problem/question :banana:

sonic3d
02-14-2003, 03:29 PM
can some1 make it so that it doesn't follow behind the descritpions but on its own.

l8er
sonic

Brain Crusher
02-15-2003, 06:47 PM
Originally posted by george_proost
?0.02

I used the basis of the hack. Modified extremely... and works great. Does not generate many extra queries, and is damn fast.

Features added :
- Bold on new messages
- custom forum type
- variable number of columns to display per parents children

added 2 fields to forum table showas and numcols
this is the index.php version.


Can you post a code to insert the two fields with php mysql admin? I don?t know must be the fields a smallint(6) or a mediumint(8) or...?

Brain Crusher
02-15-2003, 07:29 PM
Originally posted by george_proost
?0.02

I used the basis of the hack. Modified extremely... and works great. Does not generate many extra queries, and is damn fast.

Features added :
- Bold on new messages
- custom forum type
- variable number of columns to display per parents children

added 2 fields to forum table showas and numcols
this is the index.php version. For the forumdisplay.php
there is some stuff to comment out ( or in) dependeing on your requirements (sorts out spacing before and after subforum lists)

See it in action at www.mainframeforum.com

here is the code, I do not support it, have fun .....

// ************************************************** ******************
// ADDED BY ERK
// ************************************************** ******************
$subforums=$DB_site->query("select title,forumid,lastpost,replycount,threadcount,show as,numcols from forum where parentid = $forum[forumid] and active != 0 ORDER BY parentid,displayorder");
if ($DB_site->num_rows($subforums)>0)
{
$subs = "<smallfont><table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" align=\"center\" id=\"ltlink\" ><tr valign=\"top\"> ";

$num_cols = $forum[numcols];
$col_width = floor(100/$num_cols);
$num_rows = ceil($DB_site->num_rows($subforums)/$num_cols);
$cur_col = 0;
$cur_row = 1;

while ($forum_child=$DB_site->fetch_array($subforums))
{
$permission=$DB_site->query_first("select accessmask from access where userid = $bbuserinfo[userid] AND forumid = $forum_child[forumid]");
if ($permission['accessmask'] != 0 || $permission['accessmask'] == null)
{
// ------------------------------
// check new messages in subforum
// and set 'bolding' attributes
// ------------------------------
$bold_on = "";
$bold_off = "";
if ($bbuserinfo['lastvisitdate']=='Never') {
$bold_on = "<b>";
$bold_off = "</b>";
} else {
if (isset($bbforumview[$forum_child['forumid']]) and $bbforumview[$forum_child['forumid']]>$bbuserinfo['lastvisit']) { $userlastvisit=$bbforumview[$forum_child['forumid']];
} else {
$userlastvisit=$bbuserinfo['lastvisit'];
}
if ($userlastvisit<$forum_child['lastpost']) {
$bold_on = "<b>";
$bold_off = "</b>";
} else {
$bold_on = "";
$bold_off = "";
}
}

if ($cur_row == 1)
{
$subs.="<td width=\"$col_width%\">";

$cur_col++;
}
$subs.="<table cellspacing=\"0\" cellpadding=\"1\" border=\"0\" width=\"100%\"><tr valign=\"top\" ><td nowrap><font class=\"sf\">- </td><td width=\"100%\">";
$subs.="<a href=\"$bburl/f$forum_child[forumid]/s\">";
$child_text = "$bold_on$forum_child[title]$bold_off&nbsp;";

// switch on showas
switch ($forum_child[showas])
{
// FULL AFFILIATES
case "AFF":
$subs.="<font class=\"sf\" color=\"darkblue\">$child_text</font></a><img src=\"$bburl/images/star.gif\">";
break;
case "AFF_AS":
$subs.="<font class=\"sf\" color=\"white\">$child_text</font></a><img src=\"$bburl/images/star.gif\">";
break;
// VENDOR MODERATED
case "VEN":
$subs.="<font class=\"sf\" color=\"black\">$child_text</font></a><img src=\"$bburl/images/posticonnew.gif\">";
break;
// CONTRIBUTOR MODERATED
case "CON":
$subs.="<font class=\"sf\" color=\"darkgreen\">$child_text</font></a><img src=\"$bburl/images/paperclip.gif\">";
break;
// USENET FORUM ENTRIES
case "USE":
$subs.="<font class=\"sf\" color=\"brown\">$child_text</font></a><img src=\"$bburl/images/posticon.gif\">";
break;
// MEMBER MODERATED
case "MEM":
$subs.="<font class=\"sf\" color=\"darkorange\">$child_text</font></a>";
break;
// HIDDEN
case "LOW":
$subs.="<font class=\"sf\" color=\"#999999\">$child_text</font></a>";
break;
// DEFAULT
default:
// -------------------------------
// set entry to italic if no posts
// -------------------------------
// if ($forum_child[threadcount] == 0 ){
// $subs.="<font class=\"sf\" color=\"black\"><i>$child_text</i></font></a>";
// } else {
$subs.="<font class=\"sf\" color=\"black\">$child_text</font></a>";
// }
break;
} // end switch

// ---------------------
// tag on the replycount
// ---------------------
// if ($forum_child[threadcount] > 0 ){
// $subs.="<font class=\"sf\" color=\"#999999\">&nbsp;&nbsp;<i>Posts($forum_child[replycount])</i></font>";
// }

// ---------------------------------------
// check if i need to go to new column yet
// ---------------------------------------
if ($cur_row == $num_rows) {
$cur_row=1; $subs.= "</td></tr></table></td>";
}
else {
$cur_row++;
$subs.="</td></tr></table>";
}

} // end-if
} // end-while

// -------------------------------------
// close off the remaining empty columns
// and finish off the table etc..
// -------------------------------------
$todo_cols = $num_cols - $cur_col;
while ($todo_cols != 0)
{
$subs.="<td width=\"$col_width%\"></td>" ;
$todo_cols--;
}
$subs.="</tr></table></smallfont>";

if ($forum['description'] != '') {
$forum['description'].= "<br><br>$subs<br>";
}
else {
$forum['description'].= "<br>$subs"; // used in index.php
// $forum['description'].= "<br>$subs<br>"; // used in forumdisplay.php
}

$subs=null;
} // end-if
else {

if ($forum['description'] != '') {
// $forum['description'].= "<br><br>"; // used in forumdisplay.php
}
else {
// $forum['description'].= "<br>"; // used in forumdisplay.php
}

}

$DB_site->free_result($subforums);
$forum_child=null;

// ************************************************** ******************
// END ADDED
// ************************************************** ******************



Warning: Division by zero in /usr/local/httpd/htdocs/kunden/web14/html/forum/index.php on line 344

Warning: Division by zero in /usr/local/httpd/htdocs/kunden/web14/html/forum/index.php on line 345

Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 20 bytes) in /usr/local/httpd/htdocs/kunden/web14/html/forum/index.php on line 456

This sucks, help me :)!

sonic3d
02-16-2003, 05:51 PM
can ne1 help me?

Cyn
03-09-2003, 06:24 PM
I'd like to use this but have a problem I can't pinpoint. The subforum titles appear hyperlinked in the parent forum title on the home page BUT it looks like this:

Subforum1 (www.vbulletin.org) Subforum2 (www.vbulletin.org) Subforum3 (www.vbulletin.org)"> ParentForum

It looks just like that with the subforums in color and the "> and the parent forum title in black.

Why would it put the Parent forum title at the end? And why the " and the > ?

Megadeuce
09-02-2003, 08:07 PM
Works great

Bison
09-03-2003, 04:34 AM
There's another hack that doesn't add "One Query" to your forum!

MaDCaT75
09-14-2003, 03:29 AM
I tried to view the demo but it said I had no permission?

deathemperor
10-03-2003, 04:17 AM
hi there, need help ^ ^
the sub-forums in the forum home show well, but my problem is those sub-forums didnt have a hyperlink to them :( so that after i added this, it is just only to show the name of the sub-forums ( cant access them in the forum home, there is NO links )
slove me this please

X-Sector
10-19-2003, 03:53 PM
Awesome hack man

MickDoneDee
04-22-2004, 08:03 PM
This feature comes with vB3+. Example:

Admin CP --> vBulletin Options --> Forum Listings Display Options -->
Depth of Forums - Forum Home --> enter a value
Depth of Sub-Forums --> enter a value and click Save.

For example, if your forums are setup like this:

parent
--child
----child's child

And your forum depth is set to 2 and this setting is set to 3 then you will see the first two forums displayed "fully" on the forum homepage while the level 3 "child's child" forum will appear within the "child" forum's description:

parent
--child
child forum's description.
Sub-Forums: child's child