ENHANCEMENT: Allow configuration of the default number of entries to show on lists

This commit is contained in:
Hamish Friedlander 2009-07-20 06:40:44 +00:00
parent 6d0f161cf4
commit 6eebbb217c

View File

@ -10,6 +10,9 @@
class BlogTree extends Page { class BlogTree extends Page {
// Default number of blog entries to show
static $default_entries_limit = 10;
static $db = array( static $db = array(
'Name' => 'Varchar', 'Name' => 'Varchar',
'InheritSideBar' => 'Boolean', 'InheritSideBar' => 'Boolean',
@ -242,7 +245,9 @@ class BlogTree_Controller extends Page_Controller {
Requirements::themedCSS("blog"); Requirements::themedCSS("blog");
} }
function BlogEntries($limit = 10) { function BlogEntries($limit = null) {
if ($limit === null) $limit = BlogTree::$default_entries_limit;
$start = isset($_GET['start']) ? (int) $_GET['start'] : 0; $start = isset($_GET['start']) ? (int) $_GET['start'] : 0;
return $this->Entries("$start,$limit", BlogURL::tag(), BlogURL::date()); return $this->Entries("$start,$limit", BlogURL::tag(), BlogURL::date());
} }