Portal Engine Questions on portal engine and web parts.
Version 6.x > Portal Engine > Does the Universal Viewer with Custom Query work for Categories? View modes: 
User avatar
Certified Developer v7
Certified  Developer v7
spengelly - 11/4/2011 2:33:08 PM
   
Does the Universal Viewer with Custom Query work for Categories?
I was wondering if it was possible to use the universal viewer with custom query to display categories? I'd like to use the functionality in hierarchical transformation to display a tree of categories as each level has different styles. From my initial experiments you can't. The category list webpart doesn't give me the flexibility to implement the html/css markup I would like.

Has anyone done this? Is there any other way to implement categories that gives you more control of the html mark up?

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 11/14/2011 2:14:13 AM
   
RE:Does the Universal Viewer with Custom Query work for Categories?
Hi,

categories - do you mean categories which you can select in Properties of document, in Categories tab or it is just a folder name in the content tree?

In case of folder you could use a universal viewer.

In the first case you can use for example a repeater with a custom query web part. The main query would be to the CMS_Category table (it will select category name and its ID).

To the transformation which displays Category name you can insert another control which will display documents for example a data list control:


<cc1:CMSDataList ID="CMSDataList1" runat="server" ClassNames="cms.article" Path='<%# Eval("NodeAliasPath") %>'

TransformationName="cms.article.default" RepeatColumns="2" >

</cc1:CMSDataList>

<script runat="server">
protected void Page_PreRender(object sender, EventArgs e)
{
CMSDataList1.ReloadData(true);
}
</script>


To make sure that control displays only documents from correct category, you need to define its Where condition:
DocumentId NOT IN (SELECT DocumentId FROM CMS_DocumentCategory WHERE CategoryId = 6)

The number of category will be available using:

<%# Eval("CategoryID")%>


Best regards,
Ivana Tomanickova