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.

SubCategories

24567

Comments

  • Didnt you guys just agree?
  • Nope (I was arguing the opposite case), but I can see how some people would want this. So I will create a variable which supplies the theme with the amount of sub-categories a category has AND a count of all discussions it contains (in it's sub-categories and it's own), too.

    These will be extra variables, for use in themeing, not replacing any default ones.

    Sound like a good idea? =)

    Adam.
  • I agree with sjeeps on this one, but I can also see the other point of view - a toggle would be great. Alternatively, you could have a "Subcats (2) discussions (42)" or whatever the numbers may be?
  • I want to have a sub subcatigory like: (Main) People (sub) State (Sub sub)city/town It is possible to do it with this?
  • pug, as I said above, I have not implemented multiple hierarchies of categories yet. At the moment you can only have sub-categories, not sub-sub-categories (or further). My main priority was to get one level of sub-categories working. I have laid down the framework, it is within the scope of what I have written to alter it to add further hierarchies, but it would be quite an undertaking (it is a more complex notion) so if a programmer is willing to alter my code, then I will happily review their changes and add the functionality. I will think about adding support for it at a later date (I am currently writing a further 3 new extensions for Vanilla). The way I conceive further levels of sub-categories working is this: Main Category (category) (parent) - Sub Main Category (sub category) (child of parent) - - Sub Sub Main Category (sub sub category) (child of a child of the parent) - - - Sub Sub Sub Main Category (sub sub sub category) (child of a child of a child of the parent) - Another Sub Main Category (sub category) (child of parent) Another Main Category (category) [ category name | (category type) | (parent/child relationship) ] As you can see above, it works by adding more dash spaces to the beginning of a categories name. But yes, for the moment, I leave implementing this to someone else (though, given a few weeks, if it hasn't been started, I will do it myself). Adam.
  • Uploaded version 0.1.2 of SubCategories.
  • Version History:
    • 0.1.0b - First Beta
    • 0.1.0 - First Release: Added parent categories links, finished removal of redundant dashes.
    • 0.1.1 - Fixed one bug with categories beginning with only "-" and showing up as sub-categories in some places and another with category counts. General tidy up. Extrapolated SubCategories definition, and added a message to the Categories List Settings page. Also fixed a conflict with the Blog add-on (checks whether CategoryManager class exists before trying to include it).
    • 0.1.2 - Added some functions to ease theming, see readme.txt
    Okay, I couldn't work out how to add variables to the theming layer (would have been too nasty a exercise) if you know of a better way than I have done, don't hesitate to tell me.

    An exert explaining how from the readme:

    ... ================================= THEMING YOUR NEW (SUB-)CATEGORIES ================================= For the moment, the look of your sub-categories cannot be changed without altering the extension's default.php, I will look to rectify this in the future. To add the amount of sub-categories a category has to the category list, you need to edit your categories.php theme file, you should add below: <li class="CategoryDiscussionCount"> <span>'.$this->Context->GetDefinition('Discussions').'</span> '.$Category->DiscussionCount.' </li>'; this: $CategoryList .= ' <li class="CategoryDiscussionCount"> <span>'.$this->Context->GetDefinition('SubCategories').'</span> '.SubCategoryCount($Category->CategoryID).' </li>'; If you wish to have the discussion count of the category include all sub-categories discussion counts, you should change the line: <span>'.$this->Context->GetDefinition('Discussions').'</span> '.$Category->DiscussionCount.' to this: <span>'.$this->Context->GetDefinition('Discussions').'</span> '.SubDiscussionCount($Category->CategoryID).' This is just an example of how you can change the default Vanilla theme to include updated discussion and sub-category counts.
  • Nice addition AV - wish Mark would enable SoftWrap on this forum though, as that code is a sod to read without wrapping.
  • PS - may want to remove the DS_Store files :P edit - wohoo.. announcement extention works :P edit 2 - I just tried out the theme modification and it works great! Nice one!
  • Sorry about the .DS_Store, I usually remember, was in a rush this time.

    I am currently working on the sub sub sub sub sub ... categories (because I got bored, and thought of a decent way to do it).

    Adam.
  • Uploaded version 0.2.0b of SubCategories.
  • Version History:
    • 0.1.0b - First Beta
    • 0.1.0 - First Release: Added parent categories links, finished removal of redundant dashes.
    • 0.1.1 - Fixed one bug with categories beginning with only "-" and showing up as sub-categories in some places and another with category counts. General tidy up. Extrapolated SubCategories definition, and added a message to the Categories List Settings page. Also fixed a conflict with the Blog add-on (checks whether CategoryManager class exists before trying to include it).
    • 0.1.2 - Added some functions to ease theming, see readme.txt
    • 0.2.0b - Added the ability to have unlimited levels of sub-categories. Extrapolated sub-categories theme into overridable theme file (see readme.txt). Blocking sub-categories now works.
    Okay, another beta release. This edition includes unlimited levels of sub-categories, you can now go as deep with them as you require, just add more "- "s to the beginning of your category name. I have also fixed the problem stopping sub-categories from being "blocked" from the main discussion list. Not only that, but I have made it so that you can override the look of the sub-categories, by overriding the theme that I have provided in the theme folder - just copy it into your theme folder, and edit away.

    See the readme.txt for more information of how the new features work.

    NOTE: This is a beta release! Do not update if you are planning to use it on a production server, but do install it on a development server to give me feedback on the enhancements I have made, so that we can get 0.2.0 final released.

    Enjoy!

    Adam.
  • Uploaded version 0.2.0b of SubCategories.
  • Help if I upped the version number in default.php.
  • Alright, everything seems to work great.
  • AV, if this works the way I think it will, I'll be back with Vanilla (and on these boards) in no time. Thanks in advance!
  • Let me know how it goes TomTester. I am almost ready to release the final of 0.2.0, which is just a clean up, and some fixes to the ability to theme and position sub-categories.

    Adam.
  • Uploaded version 0.2.0 of SubCategories.
  • Version History:
    • 0.1.0b - First Beta
    • 0.1.0 - First Release: Added parent categories links, finished removal of redundant dashes.
    • 0.1.1 - Fixed one bug with categories beginning with only "-" and showing up as sub-categories in some places and another with category counts. General tidy up. Extrapolated SubCategories definition, and added a message to the Categories List Settings page. Also fixed a conflict with the Blog add-on (checks whether CategoryManager class exists before trying to include it).
    • 0.1.2 - Added some functions to ease theming, see readme.txt
    • 0.2.0b - Added the ability to have unlimited levels of sub-categories. Extrapolated sub-categories theme into overridable theme file (see readme.txt). Blocking sub-categories now works.
    • 0.2.0 - Tidy up. Sub-categories now render by attaching to a delegate, which is overridable by altering configuration variables. Orphaned categories are now detected and displayed in some way. Problems with sub-categories being missed off of the end of sub-category list when after further nesting of categories fixed. Fixed problems with breadcrumb links in titles on discussions and comments pages. Fixed statistics for multiple nested categories.
    This is the second release of SubCategories, only a few days on, and double the size of the first release. I have learned a lot in creating this extension, and am now more confident to get cracking with the many other Vanilla-related projects I have planned.

    This release fixes a lot of issues I was having behind the scenes with having unlimited nesting of sub-categories. The logic is quite complicated, because I didn't want to make any inherent alterations to the way Vanilla handles categories (so that compatibility with other extensions is less of a problem).

    One of the main updates in this release (bar the obvious - infinite nesting), is how the sub-categories are rendered. They are now attached to a delegate (it is more compatible than the previous method), it also means, that by overriding some configuration options, you can add sub-categories to any delegate you like.

    For instance, I have added a delegate to my discussions.php theme just below the header called SubCategories:
    $this->CallDelegate('SubCategories');
    and overloaded the $Configuration['SUBCATEGORIES_DELEGATE'] in conf/settings.php with "SubCategories". Some minor alterations to the sub-categories.php theme file (which I copied into my theme folder to overload it) later, and I have them just where I wanted them.

    Please let me know if you find any bugs =) (hopefully there shouldn't be any)

    Adam.
  • I've uploaded the new version and my previous categories no longer display. Only the parent category displays.

    I have not moved the sub-cat theme or done anything of the sort. Is there something I should be doing to bring them back?
Sign In or Register to comment.