diff options
-rw-r--r-- | web/include/news.php | 46 | ||||
-rw-r--r-- | web/index.php | 3 | ||||
-rw-r--r-- | web/ioq3.css | 6 |
3 files changed, 27 insertions, 28 deletions
diff --git a/web/include/news.php b/web/include/news.php index 92949b1..fe1a2c8 100644 --- a/web/include/news.php +++ b/web/include/news.php @@ -2,24 +2,25 @@ require("/webspace/icculus.org/news/IcculusNews.php"); $id = $_GET['id']; -if (empty($_GET['news_index'])) { $news_index = 0; } +if (empty($_GET['news_index'])) + $news_index = false; +else + $news_index = $_GET['news_index']; $news_queue = 2; -$news_item_count = 5; +$news_item_max = 5; if ($err = news_login($sock, 'localhost', 263, NULL, NULL, $news_queue)) $err = "Failed to log in: $err"; else { - if (isset($id)) - { - $digestarray[] = array( 'id' => $id ); - } - - else if ($err = news_digest($sock, $digestarray, false, $news_item_count)) + if ($err = news_digest($sock, $digestarray, $news_index, $news_item_max)) { $err = "Failed to get news digest: $err"; } - + + $current_post = 0; + $news_item_count = count($digestarray); + if (!isset($err)) { foreach($digestarray as $digestItem) @@ -29,24 +30,17 @@ else $err = "Failed to grab news item: $err"; break; } - 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&news_index=" . $ncount . "\">Newer→</a>"; + echo "<h3>" . $item['title'] . " - <em>" . date("F j, Y", strtotime($item['postdate'])) . "</em></h3>\n<p>" . $item['text'] . "</p>"; + if ($current_post++ == $news_item_count - 1) + $lastid = $digestItem['id']; + } } - 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&news_index=" . $ncount . "\">←Older</a>"; -} - - } + echo "<p>"; + if ($news_item_count == $news_item_max) + echo "<a class=\"left\" href=\"?page=news&news_index=$lastid\">←Backpedal</a>"; + if ($news_index != false) + echo "<a class=\"right\" href=\"?page=news\">To Newest→</a>"; + echo "</p>"; } news_logout($sock); diff --git a/web/index.php b/web/index.php index ccce873..c2bf23c 100644 --- a/web/index.php +++ b/web/index.php @@ -34,8 +34,7 @@ foreach ($navlist as $file => $alias) { </div> <div id="footer"> <a href="http://jigsaw.w3.org/css-validator/validator?uri=http://icculus.org/quake3/ioq3.css&warning=0">Valid CSS</a> | - <a href="http://validator.w3.org/check?uri=http://icculus.org<?php -echo $_SERVER['REQUEST_URI'];?>">Valid XHTML</a> | + <a href="http://validator.w3.org/check?uri=referer">Valid XHTML</a> | <a href="http://icculus.org">icculus.org</a> <br /> Website designed and handled by <a href="http://floam.sh.nu" title="floam">Aaron Gyes</a>. diff --git a/web/ioq3.css b/web/ioq3.css index 34bcde5..c04d274 100644 --- a/web/ioq3.css +++ b/web/ioq3.css @@ -10,11 +10,13 @@ body, html { float: left; clear: left; width: 100%; + padding-bottom: .2em; } #footer { clear: left; color: #4d4d4d; + margin-top: .2em; border-top: 1px dashed #222222; font-size: .8em; padding: .35em; @@ -125,6 +127,10 @@ ul h3 { float: right; } +.left { + float: left; +} + tt, .shell { font-family: "smoothansi", "Bitstream Vera Sans Mono", "Terminal", monospace; } |