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.

General Questions

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

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


3 Posts   581 Views


27 October 2009 at 12:27am Community Member, 135 Posts


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.



27 October 2009 at 12:45am Community Member, 135 Posts

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


27 October 2009 at 1:30am Community Member, 135 Posts

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

simply put the filter

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