summaryrefslogtreecommitdiff
path: root/modules/node/node.module
diff options
context:
space:
mode:
Diffstat (limited to 'modules/node/node.module')
-rw-r--r--modules/node/node.module19
1 files changed, 11 insertions, 8 deletions
diff --git a/modules/node/node.module b/modules/node/node.module
index 3d67408a5..f0dc3aaf1 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -1944,28 +1944,31 @@ function node_block($op = 'list', $delta = 0) {
/**
* A generic function for generating RSS feeds from a set of nodes.
*
- * @param $nodes
- * An object as returned by db_query() which contains the nid field.
+ * @param $nids
+ * An array of node IDs (nid).
* @param $channel
* An associative array containing title, link, description and other keys.
* The link should be an absolute URL.
*/
-function node_feed($nodes = 0, $channel = array()) {
+function node_feed($nids = array(), $channel = array()) {
global $base_url, $language;
- if (!$nodes) {
- $nodes = db_query_range(db_rewrite_sql('SELECT n.nid, n.created FROM {node} n WHERE n.promote = 1 AND n.status = 1 ORDER BY n.created DESC'), 0, variable_get('feed_default_items', 10));
+ if (!$nids) {
+ $result = db_query_range(db_rewrite_sql('SELECT n.nid, n.created FROM {node} n WHERE n.promote = 1 AND n.status = 1 ORDER BY n.created DESC'), 0, variable_get('feed_default_items', 10));
+ while ($row = db_fetch_object($result)) {
+ $nids[] = $row->nid;
+ }
}
$item_length = variable_get('feed_item_length', 'teaser');
$namespaces = array('xmlns:dc="http://purl.org/dc/elements/1.1/"');
$items = '';
- while ($node = db_fetch_object($nodes)) {
+ foreach ($nids as $nid) {
// Load the specified node:
- $item = node_load($node->nid);
+ $item = node_load($nid);
$node->build_mode = NODE_BUILD_RSS;
- $link = url("node/$node->nid", array('absolute' => TRUE));
+ $link = url("node/$nid", array('absolute' => TRUE));
if ($item_length != 'title') {
$teaser = ($item_length == 'teaser') ? TRUE : FALSE;