Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Showing only flagged content

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

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

Page: 1
Go to End
Author Topic: 880 Views
  • Teng
    Avatar
    Community Member
    11 Posts

    Showing only flagged content Link to this post

    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?

  • Liam
    Avatar
    Community Member
    470 Posts

    Re: Showing only flagged content Link to this post

    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 %>

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