vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Categories and subcategories (https://vborg.vbsupport.ru/showthread.php?t=58223)

cinq 10-27-2003 04:54 AM

Categories and subcategories
 
Am currently working on a hack which would require the use of subcategories.

How can I go about with this ?
As it is , the sql end has a table for the categories.
Need I create another table for subcategories ?

Am pretty lost as to where to begin.
Any help would be most appreciated.

Brad 10-27-2003 06:58 AM

The best way to do this is to add a new colum to the categories table called 'parentid'. 'parentid' will contain the id of the of the categorie your sub-cat belongs to.

Dean C 10-27-2003 10:16 AM

You need to do some reading about recursive functions. I had to do this for my [top secret] project I'm working on but I did it but I have no idea how it works ;) Basically when you make your function youc all the function within it but that's essential to learning how to do this kind of thing :)

cinq 10-27-2003 11:12 PM

Quote:

Originally Posted by Mist
Basically when you make your function youc all the function within it but that's essential to learning how to do this kind of thing :)

Thanks Mist, I know what recursive functions are , but arggghh i hate using them in programming lol :p
But even then I do not quite see how they can be used for sub cats ... could you elaborate further ? :)

Quote:

Originally Posted by Anime-loo
The best way to do this is to add a new colum to the categories table called 'parentid'. 'parentid' will contain the id of the of the categorie your sub-cat belongs to.

Thanks Brad.
What happens if a cat is not a subcat, ie a parent category ?
Sorry but am pretty new to this :o

Brad 10-28-2003 12:33 AM

Set it to something like '0' by default when they are created if they are not a sub-cat.

Dean C 10-28-2003 10:17 AM

What brad said ^^ (I use -1 for some odd reason though) :)


All times are GMT. The time now is 06:04 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01049 seconds
  • Memory Usage 1,718KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete