Forum Discussion

iftomkins's avatar
11 years ago

Get ID of current category

In implementing our mobile skin, there is one page where we want to list all the boards from multiple categories. In order to avoid having Lithium re-build the entire mobile browsing component for us...
  • AdamN's avatar
    11 years ago

    What page are you on when you're trying to output this? ${coreNode.id} shouldn't be outputting the id of the parent node. It should be the id of the current node. If you're on a community-level page (i.e. the front page, my settings, help pages, etc.) this will be the id of the community. If you're on a category page, this will be the category id. If you're on a a board page or topic page, it should give you the id of the board.

     

    The sample code Claudius provided should give you the id of the parent category if you're on a board page or topic page. If you're on a category page, you should just be able to use ${coreNode.id}. So depending on what pages your component appears, you may need to check what page you're on and adjust how you pull the id.