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.

Data Model Questions /

Get published pages in SS3


Reply


3 Posts   843 Views

Avatar
MitraX

Community Member, 20 Posts

12 October 2012 at 11:24pm

Edited: 13/10/2012 3:12am

There is no more column Status in the SiteTree table in SS3.

Is there any standard way to get published pages only, e.g. PageClass::get()->filter("Status"=>"Published") or anything similar?

Avatar
figjam

Community Member, 10 Posts

13 November 2012 at 9:33pm

I don't think you need to worry about this. Because it seems that in SS3

Page::get()->filter($filter);

will only return published pages. Try this yourself by simply un-publishing a page in a filter...

Avatar
WebSpilka

Community Member, 83 Posts

3 October 2014 at 9:44am

public function getBlogEntrys() {
      $blogEntrys = BlogEntry::get()->filter(array("ParentID" => $this->ID))->sort(BlogEntry::$item_sort);
      return $blogEntrys;
}


getBlogEntrys - return all pages published and unpublished.
How to get() only published pages?