Portal Engine Questions on portal engine and web parts.
Version 4.x > Portal Engine > Display document category name? View modes: 
User avatar
Member
Member
kentico-2622.co - 2/8/2010 3:30:24 PM
   
Display document category name?
Hi guys,

This is going to sound like a really silly question, but, how do I display the category(ies) that a document is part of?

i.e. The categories that I have selected for this document.

Thanks in advance

User avatar
Member
Member
kentico-2622.co - 2/9/2010 3:32:16 AM
   
RE:Display document category name?
Just for clarification I would like to be able to display the category for the document inside a transformation.

Any ideas?

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 2/9/2010 4:04:26 PM
   
RE:Display document category name?
Hello,

To display the categories on the site you can use the webpart described here.
If you want to display it in a transformation you need to create a custom transformation function which would get the datafrom the database. I would suggest you to take a look at the webpart and get the data the same way as the webpart. For more information about custom transformation functions please see this link.

Best regards,
Boris Pocatko

User avatar
Kentico Support
Kentico Support
kentico_radekm - 2/15/2010 2:46:39 PM
   
RE:Display document category name?
Hello.

You can use following method for this purpose: CMS.SiteProvider.CategoryInfoProvider.GetDocumentCategories(Int32, String, String)

1. parameter is documentID, 2. parameter is where condition and 3. parameter is orderBy expression.
This method returns all categories the document is a member of.

DocumentID you can get:
A. In document´s Properties -> General tab, NodeID.
B. In database, CMS_Document table.
C. Using API (for current document): CMS.CMSHelper.CMSContext.CurrentDocument.DocumentID;

This approach can be used also in your transformation, if you use this code in custom function in transformation.

Best Regards,
Radek Macalik