Not signed in (Sign In)

Categories

Vanilla 1.1.4 is a product of Lussumo. More Information: Documentation, Community Support.

Help keep Vanilla free:
Welcome Guest!
Want to take part in these discussions? If you have an account, sign in now.
If you don't have an account, apply for one now.
    • CommentAuthormindy
    • CommentTimeMay 23rd 2007
     # 1
    Hi Guys,

    I know there is total discussions on category, but is there a way to display total comments number?

    Thanks
    •  
      CommentAuthorlech
    • CommentTimeMay 23rd 2007
     # 2
    wait for it...
    •  
      CommentAuthorjimw
    • CommentTimeMay 23rd 2007
     # 3
    This comment talks about how to do this generally.
    • CommentAuthormindy
    • CommentTimeMay 23rd 2007
     # 4
    I think i have to use join to count the comment on each categories then since the comment tables does not have category ID
    •  
      CommentAuthorlech
    • CommentTimeMay 23rd 2007 edited
     # 5
    You'll want to tally a count on the CategoryID row.

    $Category->DiscussionCount
    •  
      CommentAuthorWallPhone
    • CommentTimeMay 23rd 2007 edited
     # 6
    $dm = $Context->ObjectFactory->NewContextObject($Context, 'DiscussionManager');
    $CategoryDiscussionCount = $dm->GetDiscussionCount($CategoryID);
    disclaimer: untested code
    Edit: Lech's method is better, if you have a proper category object already.
    • CommentAuthormindy
    • CommentTimeMay 23rd 2007 edited
     # 7
    SELECT COUNT(LUM_Comment.CommentID) AS COUNT_CommentID,
    LUM_Comment.DiscussionID,
    LUM_Discussion.DiscussionID,
    LUM_Discussion.CategoryID,
    LUM_Category.CategoryID
    FROM LUM_Discussion INNER JOIN LUM_Comment ON LUM_Discussion.DiscussionID = LUM_Comment.DiscussionID
    INNER JOIN LUM_Category ON LUM_Discussion.CategoryID = LUM_Category.CategoryID
    GROUP BY LUM_Comment.DiscussionID, LUM_Discussion.DiscussionID, LUM_Discussion.CategoryID, LUM_Category.CategoryID
    WHERE LUM_Discussion.CategoryID = $Category->DiscussionCount

    Like that? sorry i'm a newbie in php and mysql :p
    • CommentAuthormindy
    • CommentTimeMay 23rd 2007
     # 8
    thanks i figured it out :p
Add your comments
    Username Password
  • Format comments as