summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2003-09-09 19:05:08 +0000
committerDries Buytaert <dries@buytaert.net>2003-09-09 19:05:08 +0000
commite406d3054ee1e5765bb57f10284d66ef070ca230 (patch)
treef3c625943c44b83b6e8059471179c0c76c82f929
parent8e657f64efb3c3e12365d1c33e6ab89e40d9bfd5 (diff)
downloadbrdo-e406d3054ee1e5765bb57f10284d66ef070ca230.tar.gz
brdo-e406d3054ee1e5765bb57f10284d66ef070ca230.tar.bz2
- Added support for the optional <pubdate> element in our node RSS feeds. This
could help reduce the number of HTTP requests and fixes some annoyances with RSS clients.
-rw-r--r--modules/node.module25
-rw-r--r--modules/node/node.module25
2 files changed, 44 insertions, 6 deletions
diff --git a/modules/node.module b/modules/node.module
index f8c663212..978b01839 100644
--- a/modules/node.module
+++ b/modules/node.module
@@ -980,9 +980,28 @@ function node_feed($nodes = 0, $channel = array()) {
}
while ($node = db_fetch_object($nodes)) {
+ /*
+ ** Load the specified node:
+ */
+
$item = node_load(array("nid" => $node->nid));
- $link = url(node_url($node));
- $items .= format_rss_item($item->title, $link, ($item->teaser ? $item->teaser : $item->body));
+
+ /*
+ ** Transform the node information into an RSS item:
+ */
+
+ $items .= format_rss_item($item->title, url(node_url($node)), ($item->teaser ? $item->teaser : $item->body));
+
+ /*
+ ** Determine the publication date:
+ */
+
+ if ($item->updated > $pubdate) {
+ $pubdate = $item->updated;
+ }
+ if ($item->created > $pubdate) {
+ $pubdate = $item->created;
+ }
}
$output .= "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
@@ -994,7 +1013,7 @@ function node_feed($nodes = 0, $channel = array()) {
foreach ($languages as $key => $value) break;
if (!$channel["language"]) $channel["language"] = $key ? $key : "en";
$output .= "<rss version=\"". $channel["version"] . "\">\n";
- $output .= format_rss_channel($channel["title"], $channel["link"], $channel["description"], $items, $channel["language"]);
+ $output .= format_rss_channel($channel["title"], $channel["link"], $channel["description"], $items, $channel["language"], array("pubdate" => date("r", $pubdate)));
$output .= "</rss>\n";
header("Content-Type: text/xml");
diff --git a/modules/node/node.module b/modules/node/node.module
index f8c663212..978b01839 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -980,9 +980,28 @@ function node_feed($nodes = 0, $channel = array()) {
}
while ($node = db_fetch_object($nodes)) {
+ /*
+ ** Load the specified node:
+ */
+
$item = node_load(array("nid" => $node->nid));
- $link = url(node_url($node));
- $items .= format_rss_item($item->title, $link, ($item->teaser ? $item->teaser : $item->body));
+
+ /*
+ ** Transform the node information into an RSS item:
+ */
+
+ $items .= format_rss_item($item->title, url(node_url($node)), ($item->teaser ? $item->teaser : $item->body));
+
+ /*
+ ** Determine the publication date:
+ */
+
+ if ($item->updated > $pubdate) {
+ $pubdate = $item->updated;
+ }
+ if ($item->created > $pubdate) {
+ $pubdate = $item->created;
+ }
}
$output .= "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
@@ -994,7 +1013,7 @@ function node_feed($nodes = 0, $channel = array()) {
foreach ($languages as $key => $value) break;
if (!$channel["language"]) $channel["language"] = $key ? $key : "en";
$output .= "<rss version=\"". $channel["version"] . "\">\n";
- $output .= format_rss_channel($channel["title"], $channel["link"], $channel["description"], $items, $channel["language"]);
+ $output .= format_rss_channel($channel["title"], $channel["link"], $channel["description"], $items, $channel["language"], array("pubdate" => date("r", $pubdate)));
$output .= "</rss>\n";
header("Content-Type: text/xml");