8.5.x node.module node_title_list(StatementInterface $result, $title = NULL)
8.0.x node.module node_title_list(StatementInterface $result, $title = NULL)
8.1.x node.module node_title_list(StatementInterface $result, $title = NULL)
8.2.x node.module node_title_list(StatementInterface $result, $title = NULL)
8.3.x node.module node_title_list(StatementInterface $result, $title = NULL)
8.4.x node.module node_title_list(StatementInterface $result, $title = NULL)
8.6.x node.module node_title_list(StatementInterface $result, $title = NULL)
4.6.x node.module node_title_list($result, $title = NULL)
4.7.x node.module node_title_list($result, $title = NULL)
5.x node.module node_title_list($result, $title = NULL)
6.x node.module node_title_list($result, $title = NULL)
7.x node.module node_title_list($result, $title = NULL)

Gather a listing of links to nodes.

Parameters

$result: A DB result object from a query to fetch node objects. If your query joins the <code>node_comment_statistics</code> table so that the <code>comment_count</code> field is available, a title attribute will be added to show the number of comments.

$title: A heading for the resulting list.

Return value

An HTML list suitable as content for a block, or FALSE if no result can fetch from DB result object.

File

modules/node/node.module, line 139
The core that allows content to be submitted to the site. Modules and scripts may programmatically submit nodes using the usual form API pattern.

Code

function node_title_list($result, $title = NULL) {
  $items = array();
  $num_rows = FALSE;
  while ($node = db_fetch_object($result)) {
    $items[] = l($node->title, 'node/' . $node->nid, !empty($node->comment_count) ? array(
      'attributes' => array(
        'title' => format_plural($node->comment_count, '1 comment', '@count comments'),
      ),
    ) : array());
    $num_rows = TRUE;
  }
  return $num_rows ? theme('node_list', $items, $title) : FALSE;
}