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

Specific blog posts in separate divs


Reply

2 Posts   866 Views

Avatar
ramshackle

11 February 2011 at 2:23pm Community Member, 22 Posts

Hi there,

I have my 3 latest blog posts displaying on the homepage using the "function LatestNews($num=5)" discussed elsewhere, works fine however I'd like to have the latest single post as a 'featured' blog or top story with a photo etc, displaying in it's own div, and the next two most recent blogs underneath in a different div. I can get the single featured blog post ok, problem is displaying the next two on their own - I can display the list of 3 but the top story is repeated. Is there any way of displaying only blog posts Number 2 and 3? Or hiding post 1 from the displayed list?

I dont want to use 2 blog holders either - I want the top news story to move down to the list below automatically when a new story is posted, ie the client only has one blog to update.

Any suggestions much appreciated,
Thanks

Avatar
Phill

12 February 2011 at 12:40pm (Last edited: 12 February 2011 12:41pm), Community Member, 75 Posts

Hey

I haven't seen you previous post but you should be able to do something like

<% control LatestNews %>

<% if First %>
<div class="first-post">
<% end_if %>

$Name
$Description

<% if First %>
</div>
<% end_if %>

<% end_control %>

Heres the documentation that should help
http://doc.silverstripe.org/sapphire/en/reference/built-in-page-controls#dataobjectset-options