summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2007-04-21 13:19:18 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2007-04-21 13:19:18 +0000
commitcb3022eb0014459cbbe24064630c9430cad3f7ec (patch)
tree500c2cb7ba28f072ae3a636c3749776801fc0b90 /includes
parentfde32212a22e3041b0745708d7c4cfc07101b857 (diff)
downloadwebsite-cb3022eb0014459cbbe24064630c9430cad3f7ec.tar.gz
website-cb3022eb0014459cbbe24064630c9430cad3f7ec.tar.bz2
website-cb3022eb0014459cbbe24064630c9430cad3f7ec.tar.xz
website-cb3022eb0014459cbbe24064630c9430cad3f7ec.zip
Switched to our SF RSS feed for the news on the front page.
Diffstat (limited to 'includes')
-rw-r--r--includes/common.php6
-rw-r--r--includes/news.php53
2 files changed, 56 insertions, 3 deletions
diff --git a/includes/common.php b/includes/common.php
index 085a566..ae189b9 100644
--- a/includes/common.php
+++ b/includes/common.php
@@ -9,8 +9,8 @@ function placeHeader($page_title)
{
echo "<?xml version=\"1.0\" encoding=\"ISO-8859-15\"?>\n";
?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>The Mana World</title>
@@ -55,7 +55,7 @@ function placeHeader($page_title)
<div class="section">
<ul>
<!-- No newlines after list items because IE 6 can't handle that properly -->
- <li><a href="index.php">News</a></li><li><a href="about.php">About</a></li><li><a href="downloads.php">Downloads</a></li><li><a href="http://wiki.themanaworld.org/">Wiki</a></li><li><a href="http://forums.themanaworld.org/">Forum</a></li><li><a href="http://mantis.themanaworld.org/">Bug tracker</a></li><li><a href="links.php">Links</a></li></ul>
+ <li><a href="index.php">News</a></li><li><a href="about.php">About</a></li><li><a href="downloads.php">Downloads</a></li><li><a href="http://wiki.themanaworld.org/">Wiki</a></li><li><a href="http://forums.themanaworld.org/">Forums</a></li><li><a href="http://mantis.themanaworld.org/">Bug tracker</a></li><li><a href="links.php">Links</a></li></ul>
</div>
</div>
</div>
diff --git a/includes/news.php b/includes/news.php
new file mode 100644
index 0000000..52ad91e
--- /dev/null
+++ b/includes/news.php
@@ -0,0 +1,53 @@
+<?php
+// WARNING:
+// This code uses the "DOM XML" extension, which is only available with PHP 4.
+// Be sure to update it to use the "XML", "DOM" or "XMLReader" extensions when
+// SF upgrades to PHP 5.
+
+$feedurl = "http://sourceforge.net/export/rss2_projnews.php?group_id=106790&rss_fulltext=1";
+
+if (!$dom = domxml_open_file($feedurl)) {
+ echo "Error while fetching news feed.\n";
+ exit;
+}
+
+$root = $dom->document_element();
+$rootchilds = $root->child_nodes();
+
+foreach ($rootchilds as $rootchild)
+{
+ if ($rootchild->tagname == "channel")
+ {
+ $channelchilds = $rootchild->child_nodes();
+
+ foreach ($channelchilds as $channelchild)
+ {
+ if ($channelchild->tagname == "item")
+ {
+ $itemchilds = $channelchild->child_nodes();
+ $newsdata = array();
+
+ foreach ($itemchilds as $itemchild)
+ {
+ if (strlen($itemchild->tagname) > 0)
+ {
+ $newsdata[$itemchild->tagname] =
+ $itemchild->get_content();
+ }
+ }
+
+ print_news_item($newsdata);
+ }
+ }
+ }
+}
+
+function print_news_item($newsdata)
+{
+ echo '<div class="news">';
+ echo '<div class="news_date">' . $newsdata['pubDate'] . '</div>';
+ echo '<h3>' . $newsdata['title'] . '</h3>';
+ echo '<div class="news_body"><p>' . $newsdata['description'] . '</p></div>';
+ echo '</div>';
+}
+?>