Site structure
Version 4.x > Site structure > How to show the categories for the current page? View modes: 
User avatar
Certified Developer 10
Certified Developer 10
SteveBiznet - 9/23/2009 11:58:55 PM
   
How to show the categories for the current page?
I'm trying to figure out the best way to display an icon for each category that is assigned to the current page. Is that already part of the API (or a control) that I can re-use?

I've found all the data but it seems like this would already be out there somewhere.

Any information (one way or the other) would be much appreciated


User avatar
Member
Member
kentico_pavelk - 9/28/2009 6:59:02 AM
   
RE:How to show the categories for the current page?
Hi,

Could you please tell us how exactly it should work? I'm little bit confused where you want to use it.


Best Regards,
Pavel Knotek

User avatar
Certified Developer 10
Certified Developer 10
SteveBiznet - 9/28/2009 9:17:33 AM
   
RE:How to show the categories for the current page?
Thanks for the reply. In re-reading my original post, I may have made it sound more complicated than it should have been.

I want to display a link to a page for each category based on the categories of the current document. I have the code to do that once I have the list of categories but I was trying to figure out he best way to get that list.

I was hoping it was populated somewhere for the current document (to avoid another data call) but I wasn't able to find locate it anywhere.

What I ended up doing was using the CategoryInfoProvider:

string where = "CategoryID in (Select distinct CategoryID from
CMS_DocumentCategory Where DocumentID =" +
CMSContext.CurrentDocument.DocumentID + ")";
DataSet cats = CategoryInfoProvider.GetCategories(where,
"CategoryDisplayName", 100);


Is that the best way to do this or is there someplace I can get that the additional call?

User avatar
Member
Member
kentico_pavelk - 9/29/2009 2:42:00 AM
   
RE:How to show the categories for the current page?
Hello,

Thank you for your clarification. Your approach is correct and I would proceed the same way as you do.


Best Regards,
Pavel Knotek