Problem getting top level category id for sub item
Posted: Wed 1. Dec 2004, 11:59
Background is: I want to use NAV_TABLE_COLUMN:x dynamically on the left to display the menu for the top level category, selected from a breadcrumb menu.
I have read several postings here about getting the current category id using $GLOBALS['content']['cat_id']; The problem is, it always returns the category of the actual item in the site structure.
For example:
1 (top level, cat_id=1)
1.1 (sub level, cat_id=3)
1.1.1 (sub sub level, cat_id=5)
2 (top level, cat_id=2)
2.1 (sub level, cat_id=4)
For 1 and 2 it returns the correct value, but for 1.1 and 2.1 it returns 3 or 4, but I need the top level (1 or 2).
I hope somebody can understand what I mean. I always need to get the top level ID to display the correct submenu.
Any help is greatly appreciated.
I have read several postings here about getting the current category id using $GLOBALS['content']['cat_id']; The problem is, it always returns the category of the actual item in the site structure.
For example:
1 (top level, cat_id=1)
1.1 (sub level, cat_id=3)
1.1.1 (sub sub level, cat_id=5)
2 (top level, cat_id=2)
2.1 (sub level, cat_id=4)
For 1 and 2 it returns the correct value, but for 1.1 and 2.1 it returns 3 or 4, but I need the top level (1 or 2).
I hope somebody can understand what I mean. I always need to get the top level ID to display the correct submenu.
Any help is greatly appreciated.