From 932340a81f70f5ac391a1ddc4d1433d815512ce8 Mon Sep 17 00:00:00 2001 From: "Edward Z. Yang" Date: Sat, 26 Jul 2008 23:11:33 -0600 Subject: [PATCH] Fix bug in number of entries in News; non-countables were counted against limit. Signed-off-by: Edward Z. Yang --- XHTMLCompiler/DOMFilter/News.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/XHTMLCompiler/DOMFilter/News.php b/XHTMLCompiler/DOMFilter/News.php index e5e05bf..2997151 100644 --- a/XHTMLCompiler/DOMFilter/News.php +++ b/XHTMLCompiler/DOMFilter/News.php @@ -22,11 +22,12 @@ class XHTMLCompiler_DOMFilter_News extends XHTMLCompiler_DOMFilter rsort($result); $manager = $xc->getFilterManager(); // :TODO: Make this limit configurable - for ($i = 0, $c = count($result); $i < 5 && $i < $c; $i++) { + for ($i = $d = 0, $c = count($result); $i < $c && $d < 5; $i++) { // Test if it matches DDDD-, otherwise ignore (it's a big/legacy entry). $entry = $result[$i]; + // :TODO: Add support for nested directories $base = basename($entry); if (strlen($base) < 4 || !ctype_digit(substr($base, 0, 4))) { continue; @@ -85,6 +86,9 @@ class XHTMLCompiler_DOMFilter_News extends XHTMLCompiler_DOMFilter $entryNode->appendChild($permalink); $container->appendChild($entryNode); + + // increment one successful + $d++; } } -- 2.11.4.GIT