]> git.decadent.org.uk Git - maypole.git/commitdiff
A pager that doesn't suck when there are 400 pages.
authorSimon Cozens <simon@simon-cozens.org>
Tue, 13 Apr 2004 15:43:49 +0000 (15:43 +0000)
committerSimon Cozens <simon@simon-cozens.org>
Tue, 13 Apr 2004 15:43:49 +0000 (15:43 +0000)
git-svn-id: http://svn.maypole.perl.org/Maypole/trunk@131 48953598-375a-da11-a14b-00016c27c3ee

templates/factory/pager

index 0eaa0cb58a89dd8ee1a2e292e4207da18e2b5c97..5f10f5905830ee5079b075af47f8f81d947f69b4 100644 (file)
@@ -13,7 +13,15 @@ IF pager AND pager.first_page != pager.last_page;
 
 <P ALIGN="center">Pages: 
 [%
-     FOREACH num = [pager.first_page .. pager.last_page];
+    SET begin_page = pager.current_page - 10;
+    IF begin_page < 1;
+        SET begin_page = pager.first_page;
+    END;
+    SET end_page = pager.current_page + 10;
+    IF pager.last_page < end_page;
+        SET end_page = pager.last_page;
+    END;
+     FOREACH num = [begin_page .. end_page];
           IF num == pager.current_page;
             "["; num; "] ";
           ELSE;