PDA

View Full Version : Subforums on Forumhome (no extra queries Version)


Xenon
02-16-2003, 10:00 PM
Well, i think most of you know the hack already but with a great ammount of additional queries.

This hack shows on every forum on forumhome (also on categories if you want it so) all it's Subforums.
It works dynamically so whenever you add a forum, it will be added to the list :)

One disadvantage on having it queryless is, that if you have private subforums below nonprivate mainforums that these will be seen so (not accesable but seen)

Hope it fits in what some of you need :)

Xenon
02-17-2003, 07:13 PM
For all of you a screenie of the hack.

JulianD
02-17-2003, 07:24 PM
Hey thanks Xenon... I will surely install this hack in a near future!

N9ne
02-17-2003, 07:26 PM
Xenon, THANKYOU VERY MUCH! This hack is something i've wanted for about 9 months now, I didn't want to add any queries to my precious forumhome! Thankyou very much for this, this is truly a masterpiece, no queries at all, brilliant.

Xanthine
02-17-2003, 08:36 PM
Thanks working good for me

Xenon
02-17-2003, 08:52 PM
Thx for kind words :)

@N9ne: you know how i hate additional queries ^^

N9ne
02-17-2003, 09:30 PM
@Xenon: you know how much I too hate additional queries ;).

dnd
02-18-2003, 12:30 AM
Originally posted by Xenon


This hack shows on every forum on forumhome (also on categories if you want it so) all it's Subforums.




hi xenon

i don't want the subforums to show on main categories how can i change this?

Highlander
02-18-2003, 02:47 AM
got a parse error .. on the beginnig of

find...

got a way out ?

Highlander
02-18-2003, 02:47 AM
ok sorry..m<y mistake..

edit:

thought it was my mistkae..but.. really.. i did altered the table..added the changes to forum.php and on line 52 i got an parse error.. whats wrong?

msn:lolo@okay.net

Logician
02-18-2003, 07:31 AM
great hack pal!

Dean C
02-18-2003, 08:59 AM
Hey Xenon, you said you were reading about hacks. Not having an orgasm release of 'em ;)

Good job buddy :)!

- miSt

Xenon
02-18-2003, 10:01 AM
@dnd: well take out $forum[subforums] from the templates where you don't need em.

personally i just have added it to forumhome_level2_post template, but it depends on you where you want it to show up.

@highlander: well without the exact error i can't say anything.
but most likely you've done an mistake while installing it works as you can see...

@Logician: thx pal.

@Mist: :p ;)

Link14716
02-18-2003, 04:52 PM
I guess it's time to move my staff forum, heh.

I'll install this one. :)

Dean C
02-18-2003, 05:11 PM
Hey just checking. If you have a private sub-forum. Will it appear on the list of subforums on index.php?

Regards

- miSt

Martin64
02-18-2003, 06:28 PM
Excellent idea Xenon! :)

Xenon
02-18-2003, 06:33 PM
@Martin: thx

@Mist: maybe you should read the info's i posted :P

yes, private subforums would also be listed public (except the main forum is also private of course ;))

Erwin
02-19-2003, 05:10 AM
Stefan - you are a legend. :)

Xenon
02-19-2003, 10:45 AM
Thx Erwin :)
hmm, should i feel old now? (legends most are ^^)

Seby
02-19-2003, 12:34 PM
very nice hack Xenon, I maybe use it. Now please fix the vb home uptimization hack ;))

PiotrasG
02-21-2003, 07:28 PM
I installed your hack but cant get it to work. i checked the forum.php if something was misising its there, i run the db query its there, i posted $forum(subforums) in my forumhome_forumbits2_nopost and it doesnt how up any idea im on 2.29

also i checked in db and it added the subforums table i have my sub forum text in there

Xenon
02-21-2003, 10:54 PM
it's not:
$forum(subforums)

it is
$forum[subforums]

Boofo
02-21-2003, 11:48 PM
Great hack, Stefan. Excellent addition. Thank you. :)

And it didn't even mess anything up on my forums. ;)

Dark Jim
02-22-2003, 11:12 AM
Thank you. :) Is it possible to show post markers next to each subforum so you can see if it has new posts? (See attachment)

Xenon
02-22-2003, 12:05 PM
nope, not with 0 extra queries.....

Kars10
02-22-2003, 12:52 PM
Cool Hack, i install it right now!!
Thank you Stefan ;)

squawell
03-08-2003, 09:05 AM
Xenon i already use ur another hack call Delete/Revert multiple templates at once than i install this hack but it dont work the subforum do not show up ?so how should i do when i already install this hackDelete/Revert multiple templates at once


thankz~

Xenon
03-08-2003, 10:03 AM
the two hacks don't make problems to the other.
you must have made an mistae while installing this hack. retry it again and read the install file carefulle.

especially the last step (edit a forum) is important

squawell
03-08-2003, 10:35 AM
Originally posted by Xenon
especially the last step (edit a forum) is important
thankz Xenon u point that for me~~

now it works~~ :cool:

Xenon
03-08-2003, 11:05 AM
:)

you're welcome :)

smartwork
03-13-2003, 04:09 AM
Xenon -

Please excuse my ignorance - where do we run the initial query before going ahead with the code replacement?

Thanks!

Xenon
03-13-2003, 09:55 AM
phpmyadmin for example

lifesourcerec
03-13-2003, 04:45 PM
I'm just having bad luck. Installed it and nothing happened.

Xenon
03-13-2003, 04:51 PM
have you done the last step and edited a forum and saved?

lifesourcerec
03-13-2003, 05:40 PM
Yep. Did that also. Still nothing.

Xenon
03-13-2003, 05:48 PM
hmm, have you editet the right templates?

as noone else has any problems, you must have made an mistake, so read the instructions carefully to be sure you haven't forgotten a single instruction...

lifesourcerec
03-13-2003, 06:06 PM
In forumhome_forumbit_level2_nopost, I added:


<br><smallfont>$forum[subforums]</smallfont>


after:


<smallfont color="{categoryfontcolor}">$forum[description]</smallfont>


and I'll triple check the code, but everything was done as instructed, but nothing happens.

Xenon
03-13-2003, 06:11 PM
as said, the code is correct, you must have done something wrong....

the thing in forum.php sometimes make problems, if you haven't added it to the right positions.

if everything doesn't help, you may have an interfering hack in index.php which changes the get forum part to strong...
then i can't help

N.B.
04-20-2003, 08:37 PM
Thanks Xenon !
Nice hack ! Installed it, and works like a charm !
www.cdrbase.com if anybody wants to take a look :>

vB-Host.com
05-02-2003, 10:15 AM
Stefan,

Works great! But I went one step further, trying to add an image in front of "subforums: but I get errors... ideas?

SET subforums=CONCAT(subforums,IF(subforums='', '<br><IMG SRC=\"images/arrow.gif"\">"
Subforums: ', ', '), '<a href=\"forumdisplay.php?forumid=" . $forum['forumid'] . "\">".addslashes($forum['title'])."
</a>') WHERE forumid != $forum[forumid] AND forumid IN ($forum[parentlist])");

Xenon
05-02-2003, 10:17 AM
which error did you get?

that would help enourmously ^^

vB-Host.com
05-02-2003, 08:24 PM
different ones about char undfined or not expected.. different ones as i tried to move the coding around to make it work. I don't know custom php coding well yet so I put something in wrong somewhere... what i am trying to do is put an image before the word "subforums" of course doing so in the forum home template places the image even if there isn't sub forums.

Xenon
05-03-2003, 01:36 PM
hmm you have this code:
SET subforums=CONCAT(subforums,IF(subforums='', '<br>Subforums: ', ', ')

just change it into that:
SET subforums=CONCAT(subforums,IF(subforums='', '<br><img src=\"arrow.gif\">Subforums: ', ', ')

be carefull not to have an unslashed " in your text :)

vB-Host.com
05-03-2003, 09:20 PM
when I go to update now.. I get Database error in vBulletin Control Panel 2.2.9:

Invalid SQL: UPDATE forum

SET subforums=CONCAT(subforums,IF(subforums='', '<br><img src="images/arrow.gif">Subforums: ', ', ') '<a href="forumdisplay.php?forumid=17"></A><A HREF=\"http://www.vb-host.com/hangman.php\">Play A Game Of Hangman</a>') WHERE forumid != 17 AND forumid IN (17,7,-1)
mysql error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ''<a href="forumdisplay.php?forumid=17"></A><A HREF=\"http://www

mysql error number: 1064

Date: Saturday 03rd of May 2003 03:19:18 PM
Script: http://www.vb-host.com/admin/forum.php
Referer: http://www.vb-host.com/admin/forum.php?s=&action=edit&forumid=47

Boofo
05-04-2003, 04:20 PM
I just did it and it works fine here. This is what I used:

SET subforums=CONCAT(subforums,IF(subforums='', '<br><img src=\"{ imagesfolder}/arrow.gif\"><b>Subforums:</b> ', ', ')

Take the space out of the imagesfolder variable, though.

vB-Host.com
05-04-2003, 07:15 PM
Thanks Bob, but, getting the same error still... It appears it is having the forum as links hack is causing it. It doesn't like the </a><A HREF="http://www.vb-host.com/hangman.php">click here to play hangman</A> in the SQL syntax....

The error reads...

Invalid SQL: UPDATE forum

SET subforums=CONCAT(subforums,IF(subforums='', '<br><img src="images/
arrow.gif">Subforums: ', ', ') '<a href="forumdisplay.php?forumid=17"></A>
<A HREF=\"http://www.vb-host.com/hangman.php\">Play A Game Of
Hangman</a>') WHERE forumid != 17 AND forumid IN (17,7,-1)
mysql error: You have an error in your SQL syntax. Check the manual that
corresponds to your MySQL server version for the right syntax to use near
''<a href="forumdisplay.php?forumid=17"></A><A HREF=\"http://www

mysql error number: 1064

Date: Saturday 03rd of May 2003 03:19:18 PM
Script: http://www.vb-host.com/admin/forum.php
Referer: http://www.vb-host.com/admin/forum....edit&forumid=47

Boofo
05-04-2003, 07:25 PM
It looks like it doesn't like the dash in your site name.

lifesourcerec
05-11-2003, 11:14 PM
Hehe still can't get it to work.

I put the $forum[subforums] in forumhome_forumbit_level2_nopost and editted one of my forums; still did nothing.

FreDy
05-12-2003, 03:51 PM
It works fine!! Thanks :)

This is just I needed.

lifesourcerec: I had the same problem when I installed the hack... try to add the $forum[subforums] code in several forumhome_forumbit_levelx_(no)post

I add the code to
forumhome_forumbit_level1_post
forumhome_forumbit_level2_post
forumhome_forumbit_level2_nopost

And all works correctly. Try it.

lifesourcerec
05-12-2003, 04:55 PM
Today at 05:51 PM FreDy said this in Post #49 (https://vborg.vbsupport.ru/showthread.php?postid=394165#post394165)
It works fine!! Thanks :)

This is just I needed.

lifesourcerec: I had the same problem when I installed the hack... try to add the $forum[subforums] code in several forumhome_forumbit_levelx_(no)post

I add the code to
forumhome_forumbit_level1_post
forumhome_forumbit_level2_post
forumhome_forumbit_level2_nopost

And all works correctly. Try it.

Well, I only want it under "forum description".

"<smallfont color="{categoryfontcolor}">$forum[description] <br>$forum[subforums]</smallfont>

lifesourcerec
05-12-2003, 04:57 PM
Today at 05:51 PM FreDy said this in Post #49 (https://vborg.vbsupport.ru/showthread.php?postid=394165#post394165)
It works fine!! Thanks :)

This is just I needed.

lifesourcerec: I had the same problem when I installed the hack... try to add the $forum[subforums] code in several forumhome_forumbit_levelx_(no)post

I add the code to
forumhome_forumbit_level1_post
forumhome_forumbit_level2_post
forumhome_forumbit_level2_nopost

And all works correctly. Try it.

Well, I only want it under "forum description".

"<smallfont color="{categoryfontcolor}">$forum[description] <br>$forum[subforums]</smallfont>

Doesn't show anything.

FreDy
05-12-2003, 05:56 PM
Hmm...

I added the code to 'forumhome_forumbit_level2_nopost' template only (under forum description) and it doesn't work for me too.
Then I added the same code to several templates (under forum description too) and it works.

I think that 'forumhome_forumbit_level2_nopost' isn't the correct template to show the subforums.

Try adding the code to more forumhome_forumbit_levelx_(no)post templates.

Good luck

lifesourcerec
05-12-2003, 06:32 PM
Today at 07:56 PM FreDy said this in Post #52 (https://vborg.vbsupport.ru/showthread.php?postid=394203#post394203)
Hmm...

I added the code to 'forumhome_forumbit_level2_nopost' template only (under forum description) and it doesn't work for me too.
Then I added the same code to several templates (under forum description too) and it works.

I think that 'forumhome_forumbit_level2_nopost' isn't the correct template to show the subforums.

Try adding the code to more forumhome_forumbit_levelx_(no)post templates.

Good luck

Yeah, but where (to get it under the forum description)?

FreDy
05-12-2003, 06:39 PM
Find in these templates $forum[description] and add $forum[subforum] under it.

Xenon
05-12-2003, 06:45 PM
as an description for the templatenames:

level1 is over level2 on forumhome
_nopost is for categorie forums
_post ist for normal forums

if you add it to _nopost and your forums on forumhome are no categories, you obviously won't see anything.

standart vb template system, i'd advise you to get familiar with it apart from my hack, because it's usefull to know everywhere :)

WEForums
05-12-2003, 10:47 PM
Hmm...this may seem simple but how to you get the "Subforums" to appear in bold? I tried changing it in the forum.php file and nothing happened. Then I totally removed the <br>Subforums part and Subforums STILL stayed. What's the part that needs to be changed?

Also note I don't want the subforum links in bold...

lifesourcerec
05-12-2003, 11:37 PM
Yesterday at 08:39 PM FreDy said this in Post #54 (https://vborg.vbsupport.ru/showthread.php?postid=394216#post394216)
Find in these templates $forum[description] and add $forum[subforum] under it.


I know that, but I can only find $forum[description] in level2_nopost.

WEForums
05-13-2003, 03:04 AM
Today at 01:37 AM lifesourcerec said this in Post #57 (https://vborg.vbsupport.ru/showthread.php?postid=394343#post394343)
I know that, but I can only find $forum[description] in level2_nopost. You're supposed to add $forum[subforum] to that template.

The way I believe it is:

forumhome_forumbit_level2_post for REGULAR forum

forumdisplay_forumbit_level2_post for SUB-FORUMS

Editing those files should result in what you're looking for.

lifesourcerec
05-13-2003, 03:08 AM
I got it :)... now to getting the "subforums:" to be bold...

Xenon
05-13-2003, 08:00 AM
@WE and life:
To get the subforums bold you have to edit the part in forum.php and after that, you have to edit a forum to update the cache like you have to do when you first install the hack.

lifesourcerec
05-13-2003, 01:16 PM
Today at 10:00 AM Nietzsche said this in Post #60 (https://vborg.vbsupport.ru/showthread.php?postid=394479#post394479)
@WE and life:
To get the subforums bold you have to edit the part in forum.php and after that, you have to edit a forum to update the cache like you have to do when you first install the hack.

Thanks. Worked like a charm. :)

csidlernet
06-17-2003, 04:55 AM
Thankyou!

/me hits install button

kaotic
07-19-2003, 05:20 AM
I would really like to install this nice little hack, but sadly, I'm getting an error:

Database error in vBulletin Control Panel 2.3.0:

Invalid SQL: UPDATE forum SET subforums=''
mysql error: Unknown column 'subforums' in 'field list'

mysql error number: 1054

I triple checked the query that I was suppose to run. It worked perfectly. Can someone point me in the right direction?

Xenon
07-19-2003, 10:05 AM
you must have made an error while runing the alter table query.
do it again, i can't help any further....

kaotic
07-20-2003, 03:14 AM
Is there another method that I could use to update the cache? Like a query that I could run myself.

Xenon
07-20-2003, 11:57 AM
to update the cache yourself you have to run a lot of queries yourself, so i don't suggest you'd do that ^^

also the problem you reported above is not because of the caching, but because you haven't installed the hack correctly

kaotic
07-28-2003, 01:16 AM
I knew I followed instructions correctly. After running repair.php, it finally started working. Thanks for the hack. :)

Xenon
07-28-2003, 09:51 AM
ah, ok a db problem could always produce unknown bugs ^^

:)

Oblivion Knight
07-30-2003, 03:03 AM
Working like a charm, as always Xenon :)

lifesourcerec
08-07-2003, 11:10 PM
Can't get it to work on v2.3.0

Xenon
08-10-2003, 03:26 PM
i don't know of any problems with 2.3.0 as i've written it with 2.3.0.

follow the instructions carefully and it'll work

lifesourcerec
08-10-2003, 11:05 PM
I re-did it step by step twice and no go. Added $forum[subforums] to level2_post and level2_nopost and it still doesn't work. I did edit forum and save. Nothing happening.

Xenon
08-19-2003, 08:30 PM
then i can't help, as it's not reproducable on my testboards...
are you sure you've uploaded the files correctly?

The Realist
08-21-2003, 03:33 PM
Its level1_nopost and level2_nopost templates not level2_post. Could that be your problem?

08-11-03 at 01:05 AM lifesourcerec said this in Post #72 (https://vborg.vbsupport.ru/showthread.php?postid=425001#post425001)
I re-did it step by step twice and no go. Added to level2_post and level2_nopost and it still doesn't work. I did edit forum and save. Nothing happening.

The Realist
08-21-2003, 03:34 PM
Now I have a problem. Did the hack 100% working fine but every sub forum I have is showing up as a link under the main section header?

How can I only show the sub forums I need?

Xenon
08-21-2003, 10:43 PM
the realist, sorry but this feature isn't included right now. you'd have to exclude every forumid you don't want yourself in the code

alqafelah
08-22-2003, 12:16 AM
sory Xenon,

can you make it as dropdown ?

Xenon
08-22-2003, 11:28 AM
nope, as i hate dropdowns :)
but all you have to do is to change the html code the function generates for yourself and you can make a dropdown out of it, shouldn't be hard i think.

Sooner95
08-29-2003, 01:03 AM
Took me a day or 2, but i got it.

Thanks for the awsome hack

cerebro
10-06-2003, 02:16 AM
Works fine for VB 2.3.2??

Xenon
10-07-2003, 03:39 PM
yes it should, but i haven't tested it.
as not much has changed i cannot imagine it doesn't work

deathemperor
10-10-2003, 05:20 AM
i install this, but... when i try to put $forum[subforums] in
forumdisplay_forumbit_level1_nopost, forumdisplay_forumbit_level1_post,
forumdisplay_forumbit_level2_post, or
forumdisplay_forumbit_level2_nopost.
it shows nothing, I put it right after $forum[description] in all of them, but it doesnt work
any suggestion ?

deathemperor
10-10-2003, 12:46 PM
and, I got this too:

Parse error: parse error in ***/www/forums/admin/forum.php on line 38
when trying to modify my forums

Xenon
10-10-2003, 02:10 PM
well obviously you made a mistake while installing the hack.
use an backup and start again, and be careful when changing the files, that you don't make a mistake again.

once the php file works, the subforumcache will be visible, too

deathemperor
10-11-2003, 08:53 AM
may it be....because the others hack ? I did install some others

Xenon
10-11-2003, 03:42 PM
parse error means you just make a mistake while hacking.
it could be for several reasons, but it's just a normal php error you caused while editing.
it has nothing to do with the functionality of any hacks normally

deathemperor
10-14-2003, 05:27 AM
ahh, I did it again, more carefully than before. But I still get an erorr, it said Prase erorr on line.... ( I didnt remember ). And it is in the start of your code
what should I do ?

Xenon
10-14-2003, 05:26 PM
i cannot help you then.

the code is working, so it is an error on your side.
Maybe your editor makes a problem.

As said, i can't help, the code does not contain a parse error or it won't work on the others board, too

deathemperor
10-15-2003, 01:29 PM
ok, I can MAKE SURE that I did nothing wrong, but there is no sub-forum displayed in forum home.
Or I have to add a sub-forum after install this and it will show up ? it has no effects to the old sub-forums ?

Xenon
10-15-2003, 03:26 PM
the subforums are cached, that is why you have to make the changes to admin/forum.php and update one forum after the installation, so the cache will be reconstructed

deathemperor
10-16-2003, 01:30 PM
well, I'm truly sorry, that was my terrible mistake.
I shouldn't have worked when I am exhausted :(
it works perfectly. Much thanks, Xenon

Xenon
10-16-2003, 02:59 PM
:)
np, at least it works now, that's all what counts :)

translucent
11-20-2003, 08:21 PM
Great hack! I changed the field "title" to "displayorder" in order to have the subforums sorted accordingly:

$forums=$DB_site->query("SELECT forumid, title, parentlist FROM forum ORDER BY displayorder");

cerebro
11-21-2003, 12:12 AM
i made another MOD



$forums=$DB_site->query("SELECT forumid, title, parentlist FROM forum WHERE parentid=53 OR parentid=2 OR parentid=3 OR parentid=60 ORDER BY title");



And only show First Level of Subforums, but not all.

Xenon
11-21-2003, 02:54 PM
@cerebro: that way looks better:

$forums=$DB_site->query("SELECT forumid, title, parentlist FROM forum WHERE parentid IN(53, 2, 3, 60) ORDER BY title");

cerebro
11-21-2003, 06:05 PM
@cerebro: that way looks better:

$forums=$DB_site->query("SELECT forumid, title, parentlist FROM forum WHERE parentid IN(53, 2, 3, 60) ORDER BY title");


Nice!...
sos un Groso! :d (in spanish)

Oblivion Knight
12-25-2003, 12:40 PM
Is it possible to hide sub-forums that are currently turned off (active=0).?

I've tried adding this myself, with little success..

Xenon
12-27-2003, 03:24 PM
just add a
active = 1 AND

behinde the WHERE tag

mzbcarper
01-10-2004, 04:53 PM
is there a version 4 vBB 3.0 to expect ?

Xenon
01-10-2004, 04:54 PM
vb3 has this hack already included iirc

kaotic
03-28-2004, 06:03 PM
It is? Where might I find the option to activate this feature?

Xenon
03-28-2004, 08:50 PM
you might read through the vb3 manual.

i believe it'S somewhere in the vb settings forumhome sektion

Sleepyk
03-08-2005, 11:48 PM
hey i got a problem http://kleptikmusic.com/ like the subforums do not show how you have them on 1st page, the file was edited right, and when i put $forum[subforums] in the templates it shows Subforums: K.M.B.L (Audio), K.M.B.L (Text) etc in table headers so please check out site and tell me what u think is wrong

foniac
11-01-2005, 11:39 AM
Will this work on version 3.5 or is there one like it for 3.5? I dont want them showing in a line on forum home
Thanks

Marco van Herwaarden
11-01-2005, 01:42 PM
vB2 (or vB3.0) hacks will not work on vB3.5 in 99% of the cases.

Xenon
11-01-2005, 03:46 PM
erm, this hack is already included in vb since version 3
(apart fromt he fact they never added my name to any credists pages ;))

foniac
11-01-2005, 04:54 PM
How do i make it show in v3?

Xenon
11-01-2005, 05:02 PM
i would suggest to read the manual :)

pdatoon
08-04-2007, 10:37 AM
Sorry to dig that discussion. but i deleted some subforums and they still show on forumhome. How can i correct that?

thank you for your help