Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #31 from frankmullenger/ss3-fixes

FIX: SS3 related updates.
  • Loading branch information...
commit 6dd0e7dd06ed683895ed2ab5c31fd182d709e4ca 2 parents 31c56ca + c3d9ee4
Will Rossiter wilr authored
Showing with 11 additions and 7 deletions.
  1. +11 −7 code/BlogTree.php
18 code/BlogTree.php
View
@@ -114,7 +114,7 @@ function getCMSFields() {
)));
$fields->addFieldToTab("Root.Widgets", new CheckboxField("InheritSideBar", 'Inherit Sidebar From Parent'));
- $fields->addFieldToTab("Root.Widgets", new WidgetAreaEditor("SideBar"));
+ if (class_exists('WidgetAreaEditor')) $fields->addFieldToTab("Root.Widgets", new WidgetAreaEditor("SideBar"));
return $fields;
}
@@ -208,8 +208,14 @@ public function Entries($limit = '', $tag = '', $date = '', $retrieveCallback =
// By specifying a callback, you can alter the SQL, or sort on something other than date.
if($retrieveCallback) return call_user_func($retrieveCallback, 'BlogEntry', $filter, $limit, $order);
-
- return DataObject::get('BlogEntry', $filter, $order, '', $limit);
+
+ $entries = BlogEntry::get()
+ ->where($filter)
+ ->sort($order);
+
+ $list = new PaginatedList($entries, Controller::curr()->request);
+ $list->setPageLength($limit);
+ return $list;
}
}
@@ -259,12 +265,10 @@ function BlogEntries($limit = null) {
else if(isset($_GET['authorID'])) {
$filter .= " \"BlogEntry\".\"AuthorID\" = '". Convert::raw2sql($_GET['authorID']). "'";
}
-
- $start = isset($_GET['start']) ? (int) $_GET['start'] : 0;
-
+
$date = $this->SelectedDate();
- return $this->Entries("$start,$limit", $this->SelectedTag(), ($date) ? $date : '', null, $filter);
+ return $this->Entries($limit, $this->SelectedTag(), ($date) ? $date : '', null, $filter);
}
/**
Please sign in to comment.
Something went wrong with that request. Please try again.