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

2

Comments

  • ToivoToivo New
    edited May 2007
    why categories when you could have tags? ie if tagged 'dog' additional tag is automagicallay 'animals'
  • Nice approach lex (it's really the same as subcats' but another way of thinking about how
    it could be implemented whilst maintaining compatibility)

    Toiv: I'd LOVE to have a decent tagging system (especially FIXED tags, see previous post
    Tagging mockups # 32)
  • If you look at the DiscussionTags add-on and replace the "Tags" with "SuperCategory", I think you have a solution. Just thinking out loud.
  • Does anyone think that having 'sub-categories' anytime in the near future will be possible? Personally I think it's a major component of forum's and really really makes life easy for the user & administrator.

    VBulletin has a thing where even the parent category can have post's in it. (avcorse you can set individual permissions for every category/forum in vb);
  • not in a near future no.
  • I believe subcats/kingcats are a must-have.

    jimw, I love your discussion tags add-on, but... it does not work with the tabled theme... (or delbat).

    I'd be happy with any kind of cat-grouping method, e.g. tab-level king-cats with a page-manager-UI
    (allowing for DIFFERENT cat groupings, incl. overlapping ones)

    I'd also settle for a DTags-based king/subcat mechanism (assign king/subcats from list of fixed tags,
    then create pages by 'filtering' on a certain tag search) etc. etc.

    It really shouldn't be that difficult.
  • I think Vanilla's niche is for smaller groups thus subcats are not essential IMHO. When I using SMF my users found subcats too confusing. As it is most people simply post to the general category.
  • I'm not a big fan of granular forums either --unless very large or product-specific-- but I can easily outline a
    scenario where some form of subcats (as 'filters') would be very useful.

    In our case, we run an expatriate community with 20k+ members world-wide and tremendous room for growth.

    Most members are geographically dispersed and benefit from forum discussions on a macro level (practical
    things like international movers, problems encountered, social contacts, etc.).

    Close to 50% however are located in 30-odd metropolitan areas, and benefit from discussions on a 'micro-level'
    (state /city) like tips on the best restaurants, doctors, car rental, nannies etc. etc.

    Many times expats move from one location to the next, and would love input from a person who already resides
    there. Instead of building a separate forum for every 'metropolitan area', which breaks up the community at
    large, I'd prefer to create ONE BIG forum for all, but allow for 'KING CATS' that are nothing more than discussion
    filters based on geographic location.
  • i need them...
  • Much needed addon, if only it could be developed.
  • any news about this addon?
  • Think I'm going to take a stab at it. Only thing I can see is it would require modifying the discussion loop... not sure if add-on's can have the ability to do that... A table would have to be created, to house the parent, child relationship. Other then that, should be all.... Now to find the time.... and skill! lol. I can ctrl-c + v something up nice!
  • I had a little time this weekend, so I started working on an add-on to accomplish this. However, I'm stuck on determining what delegate to use on the categories page to render the information. If someone could point me in the right direction, I would appreciate it.
  • I have made progress in this sub-category or category grouping add-on. I still need to resolve some problems, but once I get a little further, I'll get it set up on my live forum for you to test.
  • If someone could help me with understanding CategoryManager and delegates to call to get the list of Categories, I would really appreciate it. I've been struggling with the final piece to the add-on for a few days with no success. I want to filter the Categories page to show the Categories/Categories Groups hierarchy.
    Thank you, jimw
  • i don't understand programing, but thanks for the work and interest in the add-on
  • Jimw:
    To actually retrieve the list of categories, you could use this:$cm = $Context->ObjectFactory->GetContextObject($Context, 'CategoryManager'); $CategoryList = $cm->GetCategories();

    And if you wanted to modify the SQL for what that code returns you would do this:function ChangeCategoryListSql(&$CategoryManager) { $sb = &$CategoryManager->DelegateParameters['SqlBuilder']; // Do your SqlBuilder stuff here, like $sb->AddSelect, $sb->AddWhere etc. } $Context->AddToDelegate('CategoryManager', 'PostGetCategoryBuilder', 'ChangeCategoryList');
  • Thanks, WallPhone, that was a help. I'm finally finishing the extension up but have a couple of design/code questions. Is there a way to determine that a particular js file is already loaded so that I don't add it again to the header? I don't want to load again either the core Vanilla js (prototype.js and scriptaculous.js) or another extension's js files (DiscussionTags functions.js and ac.js).
  • To see if a script is already included, you would have to loop through the scripts already defined and see if they match:Function AddPrototype(&$Head) { $PrototypeFound = 0; $ScriptCount = count($Head->Scripts); for ($i = 0; $i < $ScriptCount; $i++) { if (strstr($Head->Scripts[$i], 'prototype.js')) { $PrototypeFound = 1; $i = $ScriptCount; // break out of the loop early. Comment this out if you are checking for more than one script name. } } //If Prototype wasn't found, add it. if (!$PrototypeFound) $Head->AddScript('blah-blah/prototype.js'); } $Context->AddToDelegate('Head', 'PreRender', 'AddPrototype');

    This is a touchy problem--I use a delegate to keep the possibility small that your extension would try to include prototype after all other extensions would have normally already added it.

    There is still a possibility of a conflict: If some other extension doesn't check for prototype already in place, uses the same delegate to add the script (not likely), and is enabled after your extension is--then there will be a conflict, and there isn't much you can do--unless you could code a time machine to see what scripts are added after your extension runs. (OK, maybe not a time machine, but it would be something I would not want to code.)

    Another issue to consider is what if some other extension uses a different version of prototype that is not compatible with your extension? Personally, I would just strip out the parts of prototype that I needed and include those alone.

    P.s. Just noticed my code in my last comment has the wrong function name in the AddToDelegate line at the bottom.
  • Oh, and if you are including core JS libraries and want to make sure that they don't get included twice, make this the first line inside the function:$Head->Scripts = array_unique($Head->Scripts); // remove duplicated entries
    This would only remove scripts with the same name and path. The rest of the code will check if the a file with the same name is already there--I.E. if someone names their custom code as prototype.js it would mistake that file for the 'real' prototype.
This discussion has been closed.