From a6c8b10d8e07075f2bbab81d3d972f3175ebe3ee Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Mon, 11 Nov 2002 20:59:28 +0000 Subject: Applied Moshe's patches: - Adds more title info to each line in the block: now showing author and number of comments in a unified way accross all modules. - Added pager support to blog module. - Blog module now uses standard node view, not its own hack which is more theme friendly (http://www.drupal.org/node.php?id=133). - Blog module now uses node_feed() function for making RSS feeds. since all feeds are now consolidated, a couple tweaks to node_feed() and format_rss_* would lead us to support new RSS formats easily. - Fixed bugs where unpublished entries were displayed. --- modules/node/node.module | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'modules/node') diff --git a/modules/node/node.module b/modules/node/node.module index 01098eb57..9424b3ac0 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -19,6 +19,23 @@ function node_system($field){ return $system[$field]; } +// accepts a db result object which includes nid and title from node table, and name from the user table +// returns an HTML list suitable as content for a block, and eventually other uses. +function node_title_list($result, $title = NULL) { + // no queries if site is in distress + if (module_exist("statistics") && throttle_status() > 4) { + return; + } + + while ($node = db_fetch_object($result)) { + $number = comment_num_all($node->nid); + $name = strip_tags(format_name($node)); // required for anonymous users to work + $items[] = l(check_output($node->title), array("id" => $node->nid), "node", "", array("title" => t("Author: %name, comments: %number", array("%name" => $name, "%number" => $number)))); + } + return theme_invoke("theme_item_list", $items, $title); + +} + function node_teaser($body) { $size = 400; -- cgit v1.2.3