Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Categories related with an document. View modes: 
User avatar
Member
Member
Leandro Brito - 9/19/2011 1:22:41 PM
   
Categories related with an document.
Hello,

I have two repeater on news document, the first one show the detail of document (News Detail), the second one shows TOP 5 news, but I need show only news with the same category of detail document doing a repeater of "related news" (news with the same category).
e.g.:

Repeater 1 inside "news document".
title = New mobile launched
category = mobile

Repeater 2
show the previews of news with the category mobile.

news:

iphone 5
android 2.3
windows phone
etc...


Thanks for the help.

User avatar
Member
Member
Leandro Brito - 9/19/2011 4:27:06 PM
   
RE:Categories related with an document.
I think the correct name of thread is "Documents related with category of another document" and the operation is basically the same of "tags" feature.

User avatar
Member
Member
kentico_michal - 9/20/2011 1:46:09 AM
   
RE:Categories related with an document.
Hello,

You could create a special Where condition of the Repeater web part which would filter only documents with the same categories assigned as the current document:

WHERE condition: (DocumentID IN ( SELECT DocumentID FROM CMS_DocumentCategory WHERE CategoryID IN (Select CategoryID FROM CMS_DocumentCategory WHERE DocumentID ='{%documentid%}') ))


Best regards,
Michal Legen

User avatar
Member
Member
Leandro Brito - 9/21/2011 7:04:18 AM
   
RE:Categories related with an document.
It works perfectly!

Where can I find more informations about "variables" like {%documentid%}?
Is possible access any collumn of CMS.Document table on the where condition?

Thank You!

User avatar
Member
Member
kentico_michal - 9/21/2011 7:53:04 AM
   
RE:Categories related with an document.
Hello,

It should be possible to access all columns from CMS_Tree, CMS_Document and Coupled table of the current document by using context macros.

Coupled table is a table that contains document-type specific fields defined by the developer. For example the News document type has a Content_News coupled table that contains NewsTitle, NewsSummary, NewsText and other fields specific for news.

Some related information can be found here: Content management internals

Best regards,
Michal Legen