r619 - trunk/web/include

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sat Mar 4 13:44:08 EST 2006


Author: floam
Date: 2006-03-04 13:44:08 -0500 (Sat, 04 Mar 2006)
New Revision: 619

Modified:
   trunk/web/include/news.php
Log:
First try at navigating through history.


Modified: trunk/web/include/news.php
===================================================================
--- trunk/web/include/news.php	2006-03-04 18:14:29 UTC (rev 618)
+++ trunk/web/include/news.php	2006-03-04 18:44:08 UTC (rev 619)
@@ -2,7 +2,9 @@
 require("/webspace/icculus.org/news/IcculusNews.php");
 
 $id = $_GET['id'];
+if (empty($_GET['news_index'])) { $news_index = 0; }
 $news_queue = 2;
+$news_item_count = 5;
 
 if ($err = news_login($sock, 'localhost', 263, NULL, NULL, $news_queue))
 	$err = "Failed to log in: $err";
@@ -13,7 +15,7 @@
 		$digestarray[] = array( 'id' => $id );
 	}
 
-	else if ($err = news_digest($sock, $digestarray, false, 10))
+	else if ($err = news_digest($sock, $digestarray, $news_index, $news_item_count))
 	{
 		$err = "Failed to get news digest: $err";
 	}
@@ -29,6 +31,21 @@
 			}
 			echo "<h3>" . $item['title'] . "-" . $item['postdate'] . "</h3>\n<p>" . $item['text'] . "</p>";
 		}
+		
+		$post_count = count($digestarray);
+		
+		if ($news_index != 0)
+		{
+			$ncount = ($news_index - $news_item_count);
+			if ($ncount == 0) { unset($ncount); }
+			echo "<a class=\"floater right\" href=\"?page=news&amp;news_index=" . $ncount . "\">Newer&rarr;</a>";
+		}
+		if ($post_count == $news_item_count) {
+			$ncount = ($news_index + $news_item_count);
+			if ($ncount == 0) { unset($ncount); }
+			echo "<a class=\"floater left\" href=\"?page=news&amp;news_index=" . $ncount . "\">&larr;Older</a>";
+}
+
 	}
 }
 




More information about the quake3-commits mailing list