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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Recent Posts Sidebar


Go to End


6 Posts   2480 Views

Avatar
SSTN

Community Member, 9 Posts

4 July 2010 at 1:51am

Hi, I'm building my first site with ss. WooHoo!
I'm trying to figure out how I can insert a sidebar that displays the most recent blog posts.
I'll be doing this on the homepage only.

Thanks in advance!

Avatar
Webdoc

Community Member, 349 Posts

4 July 2010 at 6:02am

hmmz
how many pages u wanna show in recent pages module?
what pagetype u use for the pages??

I have used the latestnews module functionality

Avatar
Willr

Forum Moderator, 5523 Posts

4 July 2010 at 11:46am

Avatar
SSTN

Community Member, 9 Posts

7 July 2010 at 6:17am

Willr, Thanks.
Does this apply to the Blog Module? That's what I'm using.
I'm not a coder, so I just get by, and I can't figure this out.

Avatar
Willr

Forum Moderator, 5523 Posts

7 July 2010 at 8:53am

It can be applied to anything. If you want to show the latest Blog Entries these are under the classname 'BlogEntry' so simply adapt that function to

function LatestNews($num=5) {
  return DataObject::get("BlogEntry", "Date DESC", "", $num);
}

Then in the template you can use <% control LatestNews %>$Title, $Content...<% end_control %>.

Thats how to build it using custom controls. If you have a sidebar already filled with widgets you could use a widget like http://silverstripe.org/blog-links-widget/

Avatar
SSTN

Community Member, 9 Posts

7 July 2010 at 4:20pm

Edited: 08/07/2010 7:08am

Aha! Nevermind. The instructions in the tutorial worked fine. I was just misunderstanding how to properly flush the cache to see the change.
Thanks!