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.

Help displaying latest post in each Category

edited June 2009 in Vanilla 1.0 Help
Hey all, Currently we are using the discussion overview extension with a custom categories.php file to display the latest post made under each category (just a snippet "last post in some topic by User posted at This time"). However, we also make use of the SubCategories extension and that's where the problem comes in - While displaying the latest post, it only displays the last post made under each category and ignores the sub-categories present in that category. Of course, it is clear from looking at the code why it won't work. There are some methods in the SubCategories extension which might help with this, but I'm unsure as to how to use those methods in our custom categories.php file. Does anyone know/have some pointers as to how to show the latest post under each category such that it also includes the sub-categories when getting the latest post? Extensions being used are http://lussumo.com/addons/index.php?PostBackAction=AddOn&AddOnID=189 http://lussumo.com/addons/index.php?PostBackAction=AddOn&AddOnID=312 Thanks in advance

Comments

  • The illusion that the SubCategories extension creates is only skin deep. To Vanilla, and thus all other extensions, every "subcategory" is treated as a regular, self-contained category.
  • edited June 2009
    Thanks sirlancelot. Yes, I understand that, which is why I had mentioned it was clear from looking at the code why it does not work. However, I was wondering if there was a way to get this to work so that it displays the last post made under the category (including all "sub-categories"). There are some functions like GetParent, IsSubCategory, GetLevel in the SubCategories extension which I can probably use to write a function that returns the category ID of that sub-category which contains the latest post - so that I can display that under each category in categories.php. But I'm not sure as to how I can make use of these functions from within my custom categories.php file. BTW, does anyone know if Vanilla 2 will support sub-categories? EDIT: I just got the desired result by creating a separate table which has the all category ID and the parent category ID for sub-categories (data inserted manually), I can then use this table to get all sub-categories of a particular category and go from there. While this seems like the easiest solution that will work without breaking anything - I'm still wondering if there's a better solution since every time a sub-category is created I will have to manually add an entry to this table.
Sign In or Register to comment.