Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

How to get current Category ID

edited April 2010 in Vanilla 2.0 - 2.8
I'm using nugget addon to embed some extra php code on a pages that relate to specific categories.

How do I determine what the current category id is, for a discussion list page and a comment list page?


  • Options
    edited April 2010
    Sorry, should have mentioned this is in Vanilla 1. I just can't seem to find the correct var or object that has that info.

    Something like:
    if(object->categorid == '10'){
    //echo additional content - in this case an embeded google calendar above the comment grid and/or the discussion grid

  • Options
    look at the Discussion and Comment objects, then the DiscussionGrid and CommentGrid controls. if you're in themes/comments.php, you'd get it like $this->Discussion->CategoryIDif you're in themes/discussions.php, it's at $this->Category->CategoryID
  • Options
    Thanks. Was going to do it in a nugget, but will do it in one of the theme files instead.
Sign In or Register to comment.