Help - Search - Members - Calendar
Full Version: Find Parent Category If Not Explicitly Assigned
Movable Type Community Forum > Using Movable Type > Categories and Entry Tags
mccreath
In the context of an entry archive, if an entry has a subcategory as its primary category, but is not explicitly assigned to that subcat's parent category, how can I get the label of that parent? I figured it out for the category archive itself, but have hit a wall on the entry archive.

I'm using top-level categories as the main nav, so want to use the top-level category basename to set the active state in the nav, but would like to avoid requiring the authors to set the top level category, if possible.

thanks
David
Avia
I would also be very interested if anyone knows how to do this. I feel certain there must be some way to approach it, but right now, I'm stumped! Any help would be greatly appreciated.
Avia
Ugh. I'm an idiot.

I must have stared at that page at least a dozen times today, and yet somehow always came away with the idea that the tag wouldn't work in an Entry Archive -- in other words, that it wouldn't take the category context as read. So I was messing about with iterating through MTEntryCategories, and then doing MTIFCategory type="primary," and...well, ugh. It was inefficient and messy, and I still wasn't getting it to do what I want. Why in heaven's name I never just TRIED it, I honestly have no idea.

Thank you so much, Su.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.