Jump to:

1835 Posts in 1139 Topics by 554 members

Blog Module

SilverStripe Forums » Blog Module » Specific blog posts in separate divs

Discuss the Blog Module.

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

Page: 1
Go to End
Author Topic: 813 Views
  • ramshackle
    Avatar
    Community Member
    22 Posts

    Specific blog posts in separate divs Link to this post

    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

  • Phill
    Avatar
    Community Member
    75 Posts

    Re: Specific blog posts in separate divs Link to this post

    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

    813 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.