View Single Post
  #21  
Old 09-01-2000, 01:57 PM
Guest
 
Posts: n/a
Default

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:
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:
Code:
  $categorys=$DB_site->query("SELECT categoryid,title,displayorder FROM category WHERE displayorder<>0 ORDER BY displayorder");
replace it with the following:
Code:
  $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
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01041 seconds
  • Memory Usage 1,766KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete