Technical support This forum is closed.
Version 1.x > Technical support > How to Show related articles? View modes: 
User avatar
Member
Member
Kim Abela - 4/4/2006 9:41:11 AM
   
How to Show related articles?
Hi,

Is there away to show related articles in Kentico?. For example if someone is reading an article about Italy the systen can show all articles related to the keyword Italy.

Thank you,

Kim

User avatar
Guest
admin - 4/5/2006 1:46:40 PM
   
Re: How to Show related articles?
Hi Kim,

Thank you for your post. Yes, this is possible and there are several ways how to show the related articles. If you would like to display only article documents that contain the selected keyword specified for the displayed article, you could use this:

1) Create a custom query cms.article.searchtext that will look like this:
SELECT view_cms_tree_joined.*, view_cms_tree_joined.NodeName AS SearchResultName FROM view_cms_tree_joined
INNER JOIN [CONTENT_Article] ON [CONTENT_Article].[ArticleID] = view_cms_tree_joined.foreignkeyvalue
WHERE classname = 'CMS.Article' ##WHERE ##

2) Use the QueryRepeater control (like you do for the Latest News in the sample Corporate Site). Set the QueryName property to "cms.article.searchtext" and, in your codebehind, set dynamically the WhereCondition parameter like this:

QueryRepeater1.WhereCondition = "AND articletext LIKE N'%"+ searchedKeyword.Replace("'", "''") +"%'";

Please let me know if you need any help with that.

Best Regards,

User avatar
Member
Member
gavin.bates@eggheaddesign.co.uk - 6/17/2008 4:46:38 AM
   
RE:Re: How to Show related articles?
Hi

In response to the initial post - I am trying to show (at the end of an article) all the other/related articles that are within the same page?

Is there a way this can be done?

Thanks in advance

Gavin



User avatar
Member
Member
gavin.bates@eggheaddesign.co.uk - 6/17/2008 5:01:20 AM
   
RE:Re: How to Show related articles?
Further to my last post i seem to have come across a way of achieving this by pasting the following code

<a href="<%# GetDocumentUrl() %>"><%# Eval("ArticleName") %></a>

into the appropriate transformation (listed in the configure section of the article web part) then located under Document Types in the administration area.

Although if anyone knows of a better way let me know.

Regards

Gavin