Jump to:

1844 Posts in 1600 Topics by 559 members

Blog Module

SilverStripe Forums » Blog Module » Related Posts

Discuss the Blog Module.

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

Page: 1
Go to End
Author Topic: 951 Views
  • juneallison
    Avatar
    Community Member
    108 Posts

    Related Posts Link to this post

    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!

  • biapar
    Avatar
    Forum Moderator
    435 Posts

    Re: Related Posts Link to this post

    Have you had solved?

  • juneallison
    Avatar
    Community Member
    108 Posts

    Re: Related Posts Link to this post

    @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!

    951 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.