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

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


Go to End


3 Posts   851 Views

Avatar
zim

Community Member, 135 Posts

27 October 2009 at 12:27am

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

Avatar
zim

Community Member, 135 Posts

27 October 2009 at 12:45am

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

Avatar
zim

Community Member, 135 Posts

27 October 2009 at 1:30am

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

simply put the filter

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

Thanks