From 6eebbb217c8ab27166e794917e43503ae0878055 Mon Sep 17 00:00:00 2001 From: Hamish Friedlander Date: Mon, 20 Jul 2009 06:40:44 +0000 Subject: [PATCH] ENHANCEMENT: Allow configuration of the default number of entries to show on lists --- code/BlogTree.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/code/BlogTree.php b/code/BlogTree.php index ef63809..9007673 100644 --- a/code/BlogTree.php +++ b/code/BlogTree.php @@ -10,6 +10,9 @@ class BlogTree extends Page { + // Default number of blog entries to show + static $default_entries_limit = 10; + static $db = array( 'Name' => 'Varchar', 'InheritSideBar' => 'Boolean', @@ -242,7 +245,9 @@ class BlogTree_Controller extends Page_Controller { 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; return $this->Entries("$start,$limit", BlogURL::tag(), BlogURL::date()); }