[Scummvm-cvs-logs] SF.net SVN: scummvm: [24983] web/trunk

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Wed Jan 3 23:18:56 CET 2007


Revision: 24983
          http://scummvm.svn.sourceforge.net/scummvm/?rev=24983&view=rev
Author:   fingolfin
Date:     2007-01-03 14:18:56 -0800 (Wed, 03 Jan 2007)

Log Message:
-----------
Some improvements for the news system:
* For each news item there is now a dedicate page showing just that item
* The title bar of each news items links to its dedicated page
* The Atom and RSS feeds make use of this new item specific URL
* The Atom feed now has the scummvm front page as an alternate link

Modified Paths:
--------------
    web/trunk/feed-atom.php
    web/trunk/feed-rss20.php
    web/trunk/include/news.php
    web/trunk/index.php
    web/trunk/style.css

Modified: web/trunk/feed-atom.php
===================================================================
--- web/trunk/feed-atom.php	2007-01-03 21:35:18 UTC (rev 24982)
+++ web/trunk/feed-atom.php	2007-01-03 22:18:56 UTC (rev 24983)
@@ -6,14 +6,15 @@
 require($file_root."/include/"."news.php");
 
 header("Content-Type: text/xml; charset=UTF-8");
-echo "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n";
+echo "<?xml version='1.0' encoding='UTF-8' ?>\n";
 
 $uri = $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
 
 ?>
 <feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom">
-	<id>http://<?php echo $uri; ?></id>
-	<link rel="self" href="http://<?php echo $uri; ?>" />
+	<id>http://<?=$uri?></id>
+	<link rel="alternate" type="text/html" href="http://www.scummvm.org" />
+	<link rel="self" type="application/atom+xml" href="http://<?=$uri?>" />
 	<title type="text">ScummVM news</title>
 	<subtitle type="html"><![CDATA[ScummVM is a cross-platform interpreter for several point-and-click adventure engines. This includes all SCUMM-based adventures by LucasArts, Simon the Sorcerer 1&2 by AdventureSoft, Beneath a Steel Sky and Broken Sword 1&2 by Revolution, and many more.]]></subtitle>
 	<author>
@@ -34,14 +35,15 @@
 while (list($key,$item) = each($news)) {
   $news_date = date("Y-m-d\Th:i:s\Z", $item["date"] - date("Z", $item["date"]));
   $news_url = "http://www.scummvm.org/?shownews=archive#".date("Y-m-d", $item["date"]);
-  echo "\t<entry xml:lang=\"en\">\n";
+  $news_url2 = "http://www.scummvm.org/?shownews=".$item["filename"];
+  echo "\t<entry xml:lang='en'>\n";
   echo "\t\t<id>".$news_url."</id>\n";
-  echo "\t\t<link rel=\"alternate\" href=\"".$news_url."\" />";
+  echo "\t\t<link rel='alternate' href='".$news_url2."' />";
   echo "\t\t<updated>".$news_date."</updated>\n";
   echo "\t\t<published>".$news_date."</published>\n";
-  echo "\t\t<title type=\"html\">".$item["title"]."</title>\n";
+  echo "\t\t<title type='html'>".$item["title"]."</title>\n";
 
-  echo "\t\t<content type=\"html\" xml:base=\"".$news_url."\"><![CDATA[\n\t\t".$item["body"]."\n\t\t]]></content>\n";
+  echo "\t\t<content type='html' xml:base='http://www.scummvm.org'><![CDATA[\n\t\t".$item["body"]."\n\t\t]]></content>\n";
   if ($item["author"] != "")
     echo "\t\t<author>\n\t\t\t<name>".$item["author"]."</name>\n\t\t</author>\n";
   echo "\t</entry>\n";

Modified: web/trunk/feed-rss20.php
===================================================================
--- web/trunk/feed-rss20.php	2007-01-03 21:35:18 UTC (rev 24982)
+++ web/trunk/feed-rss20.php	2007-01-03 22:18:56 UTC (rev 24983)
@@ -6,7 +6,7 @@
 require($file_root."/include/"."news.php");
 
 header("Content-Type: text/xml; charset=UTF-8");
-echo "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n";
+echo "<?xml version='1.0' encoding='UTF-8' ?>\n";
 ?>
 <rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
     <channel>
@@ -23,14 +23,15 @@
 // Display news items
 while (list($key,$item) = each($news)) {
   $news_url = "http://www.scummvm.org/?shownews=archive#".date("Y-m-d",$item["date"]);
+  $news_url2 = "http://www.scummvm.org/?shownews=".$item["filename"];
   echo "\t\t<item>\n";
   echo "\t\t\t<title>".$item["title"]."</title>\n";
   echo "\t\t\t<description><![CDATA[\n".$item["body"]."\n\t\t\t]]></description>\n";
   echo "\t\t\t<pubDate>".date("r",$item["date"])."</pubDate>\n";
   if ($item["author"] != "")
     echo "\t\t\t<author>nospam at scummvm.org (".$item["author"].")</author>\n";
-  echo "\t\t\t<guid isPermaLink=\"true\">".$news_url."</guid>\n";
-  echo "\t\t\t<link>".$news_url."</link>\n";
+  echo "\t\t\t<guid isPermaLink='true'>".$news_url."</guid>\n";
+  echo "\t\t\t<link>".$news_url2."</link>\n";
   echo "\t\t</item>\n";
 } // end of news loop
 ?>

Modified: web/trunk/include/news.php
===================================================================
--- web/trunk/include/news.php	2007-01-03 21:35:18 UTC (rev 24982)
+++ web/trunk/include/news.php	2007-01-03 22:18:56 UTC (rev 24983)
@@ -30,32 +30,29 @@
 	@fclose($fp);
 
 	// Parse the (pseudo-XML) contents of the news file.
+	$newsitem = array("filename" => $item);
 
-	$news[$c]["date"] = "";
 	if (eregi("<DATE>(.*)</DATE>", $data, $out)) {
-	  $news[$c]["date"] = strtotime($out[1]);
+	  $newsitem["date"] = strtotime($out[1]);
 	}
 
-	$news[$c]["author"] = "";
 	if (eregi("<AUTHOR>(.*)</AUTHOR>", $data, $out)) {
-	  $news[$c]["author"] = $out[1];
+	  $newsitem["author"] = $out[1];
 	}
 
-	$news[$c]["title"] = "";
 	if (eregi("<NAME>(.*)</NAME>", $data, $out)) {
-	  $news[$c]["title"] = $out[1];
+	  $newsitem["title"] = $out[1];
 	}
 
-	$news[$c]["img"] = "";
 	if (eregi("<IMG>(.*)</IMG>", $data, $out)) {
-	  $news[$c]["img"] = $out[1];
+	  $newsitem["img"] = $out[1];
 	}
 
-	$news[$c]["body"] = "";
 	if (eregi("<BODY>(.*)</BODY>", $data, $out)) {
-	  $news[$c]["body"] = $out[1];
+	  $newsitem["body"] = $out[1];
 	}
 
+	$news[$item] = $newsitem;
 	$c++;
 	
 	if ($num >= 0 && $c >= $num) {

Modified: web/trunk/index.php
===================================================================
--- web/trunk/index.php	2007-01-03 21:35:18 UTC (rev 24982)
+++ web/trunk/index.php	2007-01-03 22:18:56 UTC (rev 24983)
@@ -220,12 +220,15 @@
   $news = list_latest_news(4);
 }
 
-while (list($key,$item) = each($news)) {
+function displayNewsItem($item) {
   // Display news item
   echo '<div class="par-item">'.
 	 '<div class="par-head">'.
-	   '<a name="' . date("Y-m-d", $item["date"]) . '"></a><span class="newsdate">' . date("M. jS, Y", $item["date"]) . "</span>: ".
+	   '<a name="' . date("Y-m-d", $item["date"]) . '"></a>'.
+	    '<a href="http://fingolfin.dnsalias.net/~maxhorn/scummvm/?shownews=' . $item["filename"] . '">'.
+	      '<span class="newsdate">' . date("M. jS, Y", $item["date"]) . "</span>: ".
            $item["title"].
+        '</a>'.
 	 '</div>'.
          '<div class="par-content">'.
 		 	 '<div class="news-author">Posted by '.$item["author"]."</div> ".
@@ -233,8 +236,19 @@
 		$item["body"].
 	 '</div>'.
        '</div>';
-} // end of news loop
+}
 
+if (!$shownews or $shownews == "archive") {
+	while (list($key,$item) = each($news)) {
+	  // Display news item
+	  displayNewsItem($item);
+	}
+} else if ($news[$shownews] != "") {
+	displayNewsItem($news[$shownews]);
+} else {
+	echo "ERROR";
+}
+
 // Show 'More News...' link, unless we are already in the showsnews mode.
 if (!$shownews) {
   echo '<p class="bottom-link"><a href="?shownews=archive">More News...</a></p>'."\n";

Modified: web/trunk/style.css
===================================================================
--- web/trunk/style.css	2007-01-03 21:35:18 UTC (rev 24982)
+++ web/trunk/style.css	2007-01-03 22:18:56 UTC (rev 24983)
@@ -134,6 +134,11 @@
 	border: 0px;
 }
 
+.par-item .par-head a {
+	color: #fff;
+	text-decoration: none;
+}
+
 .par-item .par-subhead {
 	color: #a82709;
 	font-weight: bold;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list