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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

Showing only flagged content

Go to End

2 Posts   1214 Views


Community Member, 11 Posts

24 September 2008 at 5:28pm

I'm building off the tutorial, and have added a flag system to the articles in article pages. This works with a simple dropdown box is either flagged or not flagged. Now on the Article Holder page i only want to show articles that are not flagged. Would I do this similar to how latest news is shown on the homepage?


Community Member, 470 Posts

25 September 2008 at 3:09am

Yup, something similar to the below function

function showNonFlagged() {
  return DataObject::get("Page", "flagged = no"); //change to suit how you set it up.

Then use the custom control in your template to loop through them all.

<% control showNonFlagged %>
yada yada yada
<% end_control %>