Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Blog Module /

Discuss the Blog Module.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Related Posts


Reply


3 Posts   1003 Views

Avatar
juneallison

Community Member, 108 Posts

20 July 2011 at 3:04am

Hi,

I'd like to add a sidebox to my blog that shows a few related posts. This sidebox would only be visible when you are viewing a single blog entry. I've figured out how to add the sidebox. What I need advice on is how to grab and display the related posts.

By related I am thinking this would look at the tags associated with the blog entry and then show titles and excerpts of the 3 most recent posts that contain 1 or more of the tags associated with the blog entry.

And suggestions or ideas would be great.

thank you!

Avatar
biapar

Forum Moderator, 435 Posts

30 July 2011 at 10:20pm

Have you had solved?

Avatar
juneallison

Community Member, 108 Posts

31 July 2011 at 1:14am

@biapar - Thanks for asking! No, I haven't figured this one out yet.

In another thread I saw a snippet of code that looks like this:

function LatestNews($num=5) {
return DataObject::get("ArticlePage", "Tags LIKE '%news%' ", "Date DESC", "", $num);
}

...which seems along the lines of what I need. But I am not sure how I would modify this to grab the first tag or the other tags associated with the post the user is currently viewing.

If you have any suggestions, that would be great. Thanks!