Jump to:

22977 Posts in 11806 Topics by 2826 members

General Questions

SilverStripe Forums » General Questions » I want to flag hero/main story in section holder page

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

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

Page: 1
Go to End
Author Topic: 531 Views
  • zim
    Avatar
    Community Member
    135 Posts

    I want to flag hero/main story in section holder page Link to this post

    Hi.

    I am doing a project in silverstripe .

    On one of my section holder page templates display 9 stories.

    One of these stories makes up the hero at top and is displayed slightly differently to the others.

    At the moment I am using a function HeroNews (below) to get the first story and then displpaying.... This is fine but will pick out the latest story andn then when I use <% control Children %> the story is displayed again in this list.

    function HeroNews($num=1) {
    $news = DataObject::get_one("ArticleHolder");
    return ($news) ? DataObject::get("ArticlePage", "ParentID = $news->ID", "Date DESC", "", $num) : false;
    }

    .... However I want to be able to mark in CMS which story is set as main story - say with a flag of some kind. and for this story NOT to appear in the main list below.

    Does this make sense? Anyone know how I should approach this.

    Thanks

  • zim
    Avatar
    Community Member
    135 Posts

    Re: I want to flag hero/main story in section holder page Link to this post

    ...OK i have now added a boolean datafield "IsMainStory" to my page class.

    Can anyone tell me what is the correct GET statement retreive this story.

    And what Get to retrieve the rest of stories not marked as "IsMainStory"

  • zim
    Avatar
    Community Member
    135 Posts

    Re: I want to flag hero/main story in section holder page Link to this post

    I have solved this..
    sorry I should have tried before asking.

    simply put the filter

    "IsMainStory = true()or false" into GET statement.

    Thanks

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