Index: modules/node.module =================================================================== RCS file: /cvs/drupal/drupal/modules/node.module,v retrieving revision 1.527 diff -u -r1.527 node.module --- modules/node.module 2 Sep 2005 02:11:41 -0000 1.527 +++ modules/node.module 14 Sep 2005 15:58:47 -0000 @@ -646,6 +646,7 @@ $output .= form_select(t('Number of posts on main page'), 'default_nodes_main', variable_get('default_nodes_main', 10), drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30)), t('The default maximum number of posts to display per page on overview pages such as the main page.')); $output .= form_select(t('Length of trimmed posts'), 'teaser_length', variable_get('teaser_length', 600), array(0 => t('Unlimited'), 200 => t('200 characters'), 400 => t('400 characters'), 600 => t('600 characters'), 800 => t('800 characters'), 1000 => t('1000 characters'), 1200 => t('1200 characters'), 1400 => t('1400 characters'), 1600 => t('1600 characters'), 1800 => t('1800 characters'), 2000 => t('2000 characters')), t("The maximum number of characters used in the trimmed version of a post. Drupal will use this setting to determine at which offset long posts should be trimmed. The trimmed version of a post is typically used as a teaser when displaying the post on the main page, in XML feeds, etc. To disable teasers, set to 'Unlimited'. Note that this setting will only affect new or updated content and will not affect existing teasers.")); $output .= form_radios(t('Preview post'), 'node_preview', variable_get('node_preview', 0), array(t('Optional'), t('Required')), t('Must users preview posts before submitting?')); + $output .= form_select(t('Display of XML feed items'), 'feed_item_length', variable_get('feed_item_length','teaser'), array('title' => t('Titles only'), 'teaser' => t('Titles plus teaser'), 'fulltext' => t('Full text')), t('Global setting for the length of XML feed items that are output by default')); return system_settings_form($output); } @@ -1163,26 +1164,48 @@ $nodes = db_query_range(db_rewrite_sql('SELECT n.nid FROM {node} n WHERE n.promote = 1 AND n.status = 1 ORDER BY n.created DESC'), 0, 15); } + $item_length = variable_get('feed_item_length','fulltext'); + while ($node = db_fetch_object($nodes)) { // Load the specified node: $item = node_load($node->nid); $link = url("node/$node->nid", NULL, NULL, 1); - // Filter and prepare node teaser - if (node_hook($item, 'view')) { - node_invoke($item, 'view', TRUE, FALSE); - } - else { - $item = node_prepare($item, TRUE); - } + if ($item_length != 'title') { + $teaser = ($item_length == 'teaser') ? TRUE : FALSE; - // Allow modules to change $node->teaser before viewing. - node_invoke_nodeapi($item, 'view', true, false); + // Filter and prepare node teaser + if (node_hook($item, 'view')) { + node_invoke($item, 'view', $teaser, FALSE); + } + else { + $item = node_prepare($item, $teaser); + } + + // Allow modules to change $node->teaser before viewing. + node_invoke_nodeapi($item, 'view', $teaser, FALSE); + } + // Prepare the item description + switch ($item_length) { + case 'fulltext': + $item_text = $item->body; + break; + case 'teaser': + $item_text = $item->teaser; + if ($item->readmore) { + $item_text .= '

'.l(t('read more'), 'node/'. $item->nid, NULL, NULL, NULL, TRUE) . '

'; + } + break; + case 'title': + $item_text = ''; + break; + } + // Allow modules to add additional item fields $extra = node_invoke_nodeapi($item, 'rss item'); $extra = array_merge($extra, array(array('key' => 'pubDate', 'value' => date('r', $item->created)))); - $items .= format_rss_item($item->title, $link, $item->teaser, $extra); + $items .= format_rss_item($item->title, $link, $item_text, $extra); } $channel_defaults = array(