Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Add-On Request: Sub-Categories

edited August 2007 in Vanilla 1.0 Help

I know this has been mentioned several times in the forum, but I couldn't find an 'official' add-on request for it, so here 'tis!

It would be great to be able to "group" categories, so that you end up with 2 category levels (ie, each category actually belongs to a 'main' category). For instance, let's say that I have an 'animal' forum, where people discuss their various pets. Right now, I might have the following categories:

  • Dogs - Small
  • Dogs - Mediuml
  • Dogs - Largel
  • Cats - Pure Breedl
  • Cats - Mixed Breedl
  • Others - Domesticl
  • Others - Farml
  • Others - Wildl

If I could have 'sub-categories', my list would be a lot more logical

  • Dogs
    • Small
    • Medium
  • Cats
    • Pure Breed
    • Mixed Breed
  • Others
    • Domestic
    • Farm
    • Wild

Even right here in this forum, having an 'extra level' of categories might help. For instance we could have:

  • Add-Ons
    • Official Discussions
    • Requests


  • Options
    Good suggestion, icouto. I like this one indeed. Thank you
  • Options
    That would be nice. Another vote to it.
  • Options
    TomTesterTomTester New
    edited April 2007
    Maybe this discussion is relevant/useful: 'Split' category display aka category tabs (alternative to true subcategories?) # 1 (there's some code there)

    If not and someone implements, don't forget Named categories (friendly category links, category slugs) # 1
  • Options
    @TomTester: yes, the links are relevant. The 'split category display' illustrates a possible way of how sub-categories could be managed - although there are others, and at this stage, I would rather let the developer decide to implement it in whatever way is easier, so the add-on can be released sooner! :-) The 'named categores' sound like an extension/enhancement of 'friendly URLs' - again, certainly a useful addition to sub-categories, but perhaps not strictly essential for a first release! :-)
  • Options
    For sure. sub categories would be great.
  • Options
    edited April 2007
    Click on Cats category and it spits out all discussions from pure bread and mixed breed and from parent Cats category.
    What about the Parent cats category? Is it a Dummy category or u can assign that to the discussion as well.
    How will users pick the category per discussion? Will they be able to select the Cats category or will be forced to pick one of the subs.
    How many levels are u looking at? ur not going to go all crazy with 10 level deep categories are you.

    just because I'm asking questions doens't mean i'm making it. :)
    depending on the answers my mind can and might change. Don't hold ur breath.
  • Options
    @Schizo: here we are, talking about yet another extension idea, and I haven't even had a chance to try out your work for "DiscussionImages"! :-( In my mind, here is how sub-categories would work: 1) Each 'category' would either be a 'parent', or a 'category'. 2) 'Parents' cannot hold discussions. Discussions can only belong to a 'category'. So, in the example above, the user would never be able to assign a discussion to 'Cats'. "Cats" is a 'Parent', and therefore would not hold any discussions - only its own 'categories'. Users would *have* to assign a discussion to either the 'Pure Breed' or the 'Mixed Breed' categories. 3) Ideally, the depth of categories could be infinite - the difference being, that when a user creates a 'category', they choose whether it is a 'category' or a 'parent', and if it is a 'parent', it can have 'categories' of its own. When creating a 'category', the user then would get a menu listing all 'parents' available, for them to choose from (or select a default 'none', if it is to be a top-level category). 4) When selecting a category for a discussion, the 'category' menu would show all the different 'parents' and their 'categories', but the 'parents' themselves would be greyed out - so users could not select it. This is how I've visualised it. Others, of course, may have different - and better - ideas! :-)
  • Options
    how will the category page look like
    what happens if u select the parent category
  • Options
    @schizo: the category page would look just like it does now - a list of categories - the only difference being, that they would be grouped under a "heading" (the title of the 'parent'). Parents cannot be selected: in the 'categories' page they generate headings (not links), and in menus where they appear (like when starting a new discussion), they would be greyed out! :-)
  • Options
    what u described here is pure cosmetic change.
    I was thinking that if u select the parent it should pull content from all its children. that would have been an exciting thing to do.
  • Options
    just throwing some stuff out there -

    allow parents to be clickable, clicking does what schizo said, and shows all discussions that belong to its children categories.

    how are you going to display categories on the discussions page? say i have this going on:




    how are you going to handle categories with the same name? (does vanilla even allow this now, or does it just use the category id?) that being said, if you can not name the same category twice i'd see that as being a limitation, and if you can, how am i supposed to tell apart categories on the discussions page? perhaps display the parent as well, like a sort of "breadcrumb" trail (ie: Category: Televisions - Medium)? only problem is if there are a lot of sublevels, this could make for some really long entries.

    just a couple thoughts.
  • Options
    I agree with Schiz/Gauz on the parent -> posts from all subcategories (at least as an optional preference)

    Re: categories with the same name

    Since parents cannot have the same name, the parent name would make the category URL unique, e.g.

    Re: display of category overview

    Why not use the same thing SMF does, where subforums aka 'child boards' are simply listed in-line, see
    If implemented as a list, CSS can be used to style it in different ways later.

    Alternate suggestion: give each parent its own TAB.
  • Options
    There are ways to do nested categories without ever having the depth become an issue at all, do some googleing for "Preorder Tree Traversal". It's amazingly cool compared to simple "parent_id=X" setups.

    I think the idea of clicking a parent and having it bubble up the lower branch posts is a neat idea. It would have to take permissions to the subcats into account, of course. However, if you allow posting to a category that has children, how do you differentiate those discussions from the ones that "bubbled up"? Should you?

    It seems the most flexible would be a cat system with those two items as options, namely:

    [yes] [no] Allow Posting to Categories with Children [yes] [no] "Bubble Up" discussions
    Just those two options provide for a pretty good level of agility for something like this.
  • Options
    the more i think about this. more I don't want to do it.
    making subcategories isn't hard at all.

    Making all the other extensions that use categories to be compatible with subcategories will be a mess.
    Extensions like Discussion Overview, Category Jumper, Category filter etc will have to be patched to take subcategory into account. that is sooooo not going to happen.
    And i don't want to take the heat if subcategory extension doesn't work with any other extension that uses categories.

    Now i understand why no one wanted to do this. its a simple idea, yet no extension developer made it.
  • Options
    edited April 2007
    @chuyskywalker that preorder tree traversal is awesome and real fast. thanks explain bubble up? looking at how subforums work on punbb or phpbb. they are just cosmetic. there is nothing unique about subforums. other than being called subforums. and being listed on the main page. there is nothing to them. Do we have a chance to improve upon the idea of subforums and make their working unique and different to what other forums have.
  • Options
    Bubble up -- what I mean was discussed earlier.

    Notice how, by default, Vanilla shows EVERYTHING on the home page? That's every discussion "bubbling up" to the root category node, so to speak.

    Now, add a few more levels of depth and jump to a level 1 depth -- do you see things specifically assigned directly to that category ( typical subforuming ) or does it "bubble up" discussions from lower levels like above example.

    That's what I mean.
  • Options
    @Schizo: is there no way to make parents and children categories appear as 'normal' categories for these other extensions, in order to avoid compatibility problems?
  • Options
    edited May 2007
    well u will have to give up somethings for that to happen
    U cannot close Parent categories. They have to be normal categories. No exceptions.
    You won't be able to pull discussions from the child category if ur looking at the parent category. I'm not sure about this. cause easy way is to rewrite a new Discussion page to do that. which will break all discussion page extensions. there might be a hard way to do this without requiring a new discussion page. I will look into this more carefully, before I officially reject this idea.

    This preoder Tree traversal will require changes to the Vanilla core.
    Doing it as ParentID won't.
  • Options
    @Schiz: since there's nothing right now, even a SIMPLE solution that attains 80% of the result with
    20% of the effort would really be worth it.

    For compatibility subcategories could be 'presented' to older add-ons as before, e.g. 'Dogs - Small'
    to prevent breaking anything (note: based on past experience, popular add-ons are revised in days)
  • Options
    i think you are bad handling this idea, if you already have categories, and make sub cats is very difficult (change vanilla core etc...) why don´t you make king catgories, using the cats that people already have...

    so, if i have in my forum this categories: dogs, cats, others

    i could group my existing categories into a king category:

    Animals <- king categorie
    dogs <- categorie that i already have in forum
    cats <- categorie that i already have in forum
    others <- categorie that i already have in forum

    was it helpful?
This discussion has been closed.