PDA

View Full Version : Changing index.php for custom category list?


08-28-2000, 10:11 AM
I share my forums with some other motorsport sites including some rally sites. What I would like to do for them is allow them to link to my front page but only see the rallying and one other category i.e. I have the categories
General Racing Rallying Computers Private Messaging

Want I want to do is create a new index.php say rallyindex.php which will only display
General Rallying Private Messaging

I've had a look around index.php but can't make head nor tail of it. Anyone be kind enough to help?

08-28-2000, 12:50 PM
Go look at http://www.bigsoccer.com. Is this what you are looking for?

Jesse

08-28-2000, 12:55 PM
No. Nothing like that. I don't need an active topics feed.

I simply want my index page to *not* display 2 of the categories but display all the remaining categories (plus the forums within them of course) this only being the case if the user arrives at a site through say rallyindex.php instead of index.php which will display all the categories and forums within them.

08-28-2000, 12:57 PM
Um, you looked at the wrong thing. Click on the geographic links at the top of the page.

08-28-2000, 12:58 PM
Mark,
I dont think hes talking about the active topics....if you click on the links in the red bar at the top I think that is exactly what you want

~Chris

08-28-2000, 01:05 PM
Ah yes, Sorry. That is precisely what I am looking for.

Care to share how this was done?

PS. Bit busy that board isn't it!!

08-28-2000, 01:17 PM
Thats exactly what I'm looking for also.

08-28-2000, 01:25 PM
I would also like this feature.

08-28-2000, 01:59 PM
yeah i wouldn't mind that for some of the future forums i am setting up ... :D

08-28-2000, 10:07 PM
Me too Me too!!! :D

08-28-2000, 10:33 PM
well i think i found what huss used...

a hack called myforums by godfather... too lazy to get the thread... but i think it's part of a bookmark forum hack ?

08-28-2000, 10:42 PM
I posted info on how to modify index.php to only display the forums that you want. Others have posted similiar info also. Just search for something like (index.php custom)

08-28-2000, 10:44 PM
here's the godfather one http://vbulletin.com/forum/showthread.php?threadid=1029..

that one is not what i want... got search for rangersfan's one :D

found it http://vbulletin.com/forum/showthread.php?threadid=1433

[Edited by eva2000 on 08-28-2000 at 07:46 PM]

08-28-2000, 10:49 PM
Actuall it is here http://www.vbulletin.com/forum/showthread.php?threadid=1433

And you posted in it so I guess you forgot? Note John mentions an easy way to set custom styles per forum in the "Next Major Version". So I guess it would be prudent to just sit on this and wait for the release in a few weeks time and see if it is in there?

08-28-2000, 10:53 PM
so can someone make sense of that thread http://vbulletin.com/forum/showthread.php?threadid=1433 ? rangersfan and johnnyquest both hack good ways of doing it...

08-29-2000, 10:20 AM
I am lost in confusion on those threads. :confused: Isn't there a simple disilled instructions anywhere or even just a hint :) as to how to make a customindex.php file to just show certain directories. All this stuff seems too much for my simple requirements.

08-29-2000, 11:40 AM
Originally posted by rangersfan
Actuall it is here http://www.vbulletin.com/forum/showthread.php?threadid=1433

And you posted in it so I guess you forgot? Note John mentions an easy way to set custom styles per forum in the "Next Major Version". So I guess it would be prudent to just sit on this and wait for the release in a few weeks time and see if it is in there? yeah i lost the thread... i tried your way of doing it and it's alot easier i think...

i did a sample at http://animeboards.net/forums/tvshows.php

problem is the header and footer for the category page still shows the header and footer from the main forum at the index.php page.

08-29-2000, 11:02 PM
Huss, why do you even post if you're not going to offer any help at all? I've seen a bunch of threads where you tease people with hacks and then never post about it again.

Its really annoying.

Goldenboy

09-01-2000, 03:59 AM
please can you post this hack?

09-01-2000, 01:57 PM
Here is the complete custom category hack:

1) Make a copy of index.php.

2) At the very beginning of this file add the following code:

if (isset($go)) {
if ($go==1) {
$catname="Category 1";
$yourcat="16_2_4_13_14";
} elseif ($go==2) {
$catname="Category 2";
$yourcat="3_16_2_4_13_14";
} elseif ($go==6) {
$catname="Category 3";
$yourcat="1_2_13_4_14";
} else {
$catname="";
$yourcat="3_16_2_4_13_1_11_7_14";
}
} else {
$catname="";
$yourcat="3_16_2_4_13_1_11_7_14";
}

$yourcat=str_replace("_", " OR categoryid=", $yourcat);

You need to replace the category names with the name that you are going to call each custom category list. Also, you need to change the numbers in each $yourcat variable to include the categories for that list. For example, in the above code, I will have a custom category called "Category 3" that contains categories 1, 2, 13, 4 and 14. The order of the categories here doesn't matter.
The final two else statements should contain all visible categories.

3) Find the following line:
$categorys=$DB_site->query("SELECT categoryid,title,displayorder FROM category WHERE displayorder<>0 ORDER BY displayorder");
replace it with the following:
$categorys=$DB_site->query("SELECT categoryid,title,displayorder FROM category HAVING categoryid=$yourcat ORDER BY displayorder");

4) In the forumhome template, you can insert the variable $catname wherever you want the custom list name to appear.

5) to call this script, simply add the parameter ?go=number of custom category. For example, if you have called this script index2.php, you would link to http://www.yourdomain.com/forum/index2.php?go=1 and you would only see the forums which you designated for category 1. The categories will appear in the order you have them designated in the control panel.

I hope this makes sense. I realized while trying to describe this that custom categories isn't the best wording as this still uses the set categories from the board. You can see an example of this here: http://www.bigsoccer.com/forum/boards.php?go=3

09-01-2000, 05:26 PM
thanks that worked wonderfully in dividing my forum into 2

1. anime http://animeboards.net/forums/anime.shtml

2. non-anme
http://animeboards.net/forums/noanime.shtml

just made 2 copies of the custom index.php file

anime.php?go=1 defined all anime categories then i used anime.shtml to SSI anime.php?go=1

noanime.php?go=1 defined all non-anime categories then used noanime.shtml to SSI noanime.php?go=1

in anime.php and noanime.php i redefined the forumhome template for a custome one for each of the 2 copes so they can have a custom home link back to anime.shtml and noanime.shtml
eval("echo dovars(\"".gettemplate("forumhome")."\");");

forumhome-anime template
forumhome-noanime template

09-01-2000, 11:41 PM
JonnyQuest, another little question :D

is it possible to set a categoryA not to display on the real index.php page (display order=0 in the control panel) but to have the categoryA show itself on a custom category page i.e. categoryA.php (a copy of index.php) ?

cause right now i tried hiddening a category on index.php called test but in the custom category at http://animeboards.net/forums/noanime.php?go=1, category test shows up at the very top in '0' position ...

[Edited by eva2000 on 09-01-2000 at 08:46 PM]

09-05-2000, 02:26 AM
eva,
I'm a bit confused by your question. I looked at that URL and didn't see the hidden category you are talking about.
The custom category hack I wrote will display hidden forums if you set them to appear in the category list. If you don't want them to appear, add the displayorder<> into the select statement, or even easier, don't put them into the category list.
I hope this makes sense.

09-05-2000, 06:26 AM
what i was trying to ask is, i want to hide a category CategoryAfrom the normal index.php file (i.e. set display=0 in the control panel) but in the custom file noanime.php i want to show the category, CategoryA in a particular order not necessary at 0 (top position)

noanime.php i want would list would be like

CategoryB (display=1)
ForumB1
ForumB2

CategoryA (display=2) and not at display=0
ForumA1
ForumA2

---------
the problem is to hide CategoryA in index.php you set it to display=0 so it moves the category to the very top of the page although hidden.

09-05-2000, 12:21 PM
Goldenboy,

I have been out of town for a week due to personal matters. JonnyQuest posted the hack in my stead.


Originally posted by Goldenboy
Huss, why do you even post if you're not going to offer any help at all? I've seen a bunch of threads where you tease people with hacks and then never post about it again.

Its really annoying.

Goldenboy

09-05-2000, 12:41 PM
eva,
I believe what you're saying is that you want to be able to control the order of categories which are hidden (display=0). This one is a bit tougher. You can set the displayorder to look at a different field in the select statement, or to list them alphabetically. You may try setting the display to a negative number, allowing you to control what order the hidden forums appear in(?). However, I believe that the hidden forums will always appear before the non-hidden forums.
This will require a totally different hack to pull off.

09-06-2000, 04:27 AM
thanks was worth a shot :D ... can negative display orders work... i'll give it try first... for now i just created in advance 6 categories test1 through to test6 and set them all to display=0 and that work on that order...

nevertheless this is a great hack and thanks... it has allowed me to further expand my forums :D

09-09-2000, 05:21 PM
One main thing.

Say that i don't want index.php to display all the categories ever and thus the user must come in with ?go=x how could i make it in the elseif statement to say take the person to a different page where they are given an option of the various go=? that they can then enter in.

Does that make sense? My forum has quite a few distinct major categories and i only want visitors to be able to be in 1 of these at once.

Thanks for any help on this, the mod is a lifesend.

09-09-2000, 07:05 PM
One more little thing on this subject on the thread display i have got:

ASciFi.com > General Discussion

Ok, what i want to do is have

AsciFi.com> $catname(with a link like index.php?go=3) > General Discussion.

What templates will i need to edit? I assume i will need a template for each ?go=x but which template do i need to edit in.

Thanks again.

09-10-2000, 11:50 AM
eva2000,

i think there is another way of doing what you want. How about only having 1 index file, indexcustom.php but call it index.php. Those categories that you want hidden in the normal index.php just don't include in the

} else {
$catname="";
$yourcat="1_2_3_4";
}
} else {
$catname="";
$yourcat="1_2_3_4";

bit and then they won't show up. You can still set their order normall then.

See what i mean?

09-10-2000, 01:22 PM
ah yes i see... i am slowing down on this and other hacks... waiting for word on the next release...

thanks

09-10-2000, 02:01 PM
Yeah, this is the only hack i am installing :-), i got what you want working:

see http://www.ascifi.com/forums/index.php
same as
http://www.ascifi.com/forums/index.php?go=1

shows the stargate forums:

see http://www.ascifi.com/forums/index.php?go=2

shows sci-fi movies forums

of course 3 levels of categories would be better, hopefully in next release. Wonder how long :smile:

09-10-2000, 04:11 PM
Chris,

How'd you do that?

09-10-2000, 04:17 PM
Originally posted by chrispadfield
Yeah, this is the only hack i am installing :-), i got what you want working:

see http://www.ascifi.com/forums/index.php
same as
http://www.ascifi.com/forums/index.php?go=1

shows the stargate forums:

see http://www.ascifi.com/forums/index.php?go=2

shows sci-fi movies forums

of course 3 levels of categories would be better, hopefully in next release. Wonder how long :smile: cool so it works... the reason i wanted it is to start up forums unrelated to my vb... conincidently the off topic forums on my site are sci-fi/fantasy/tv related :D

09-10-2000, 05:19 PM
Make it so that you have only one index.php. Put this at the top:

if (isset($go)) {
if ($go==1) {
$catname="Stargate";
$yourcat="1_2_3_4_5_6";
} elseif ($go==2) {
$catname="Sci Fi Films";
$yourcat="7_8_9_10_11_12_13";
} elseif ($go==3) {
$catname="Farscape";
$yourcat="14_15_16_17_18";
} else {
$catname="";
$yourcat="1_2_3_4_5_6";
}
} else {
$catname="";
$yourcat="1_2_3_4_5_6";

As you can see, i have 3 'versions' of index.php

1) Stargate
2) SciFi Films
3) farscape

with go=1 for stargate
with go=2 for films
with go=3 for farscape

but by setting the else statements to the same categories as go=1 (ie stargate) then a call to index.php without go will result in just showing the stargate categories.

See what i mean.

Any one got any ideas on my question though? how to make it so that a call to index.php without go will just take you to a different html page. Thanks

09-10-2000, 05:24 PM
conincidently the off topic forums on my site are sci-fi/fantasy/tv related :D

[/B]

Hehe.. competition hey.. agghhh... guess i know who not to help from now on :smile:

09-17-2000, 01:13 PM
you say:

4) In the forumhome template, you can insert the variable $catname wherever you want the custom list name to appear.

I would like to be able to have the url

like http://www.domain.com/forums/index2.php?go=$num

is that going to be ok if i do


if ($go==1) {
$catname="Stargate";
$yourcat="1_2_3_4_5_6";
$num="1"

like that and then just put the above url in the template. Do i need to add anything else anywhere to make this work?

Thank you.

09-17-2000, 01:18 PM
Ok this does not work. Somewhere do i need to add the variable $catnumber to make it work?

Thank you, this would be extremley helpfull.

09-17-2000, 01:22 PM
Ok, i was being silly. This does work. Ignore my request :-)

09-17-2000, 02:06 PM
Sorry to continue this, but I am stuck:

Ok, I have got what I was talking about for the main pages and also for the thread page (using the same procedure but for forumid.

The problem is i don't know how to do it for showthread because i can't use the ?threadid because i do not know in advance which category it will be in.

---

So... is there anything inside showthread that i can use as a variable to test to see which category that is in. If i know which category it is in then i can add what I need. So how do I find out?

Thanks. Hope that makes sense.