Same name and namespace in other branches
  1. 4.7.x modules/book.module \book_render()
  2. 5.x modules/book/book.module \book_render()
  3. 6.x modules/book/book.pages.inc \book_render()
  4. 7.x modules/book/book.pages.inc \book_render()

Menu callback; prints a listing of all books.

1 string reference to 'book_render'
book_menu in modules/book.module
Implementation of hook_menu().

File

modules/book.module, line 579
Allows users to collaboratively author a book.

Code

function book_render() {
  $result = db_query(db_rewrite_sql('SELECT n.nid, b.weight, n.title FROM {node} n INNER JOIN {book} b ON n.nid = b.nid WHERE b.parent = 0 AND n.status = 1 AND n.moderate = 0 ORDER BY b.weight, n.title'));
  while ($page = db_fetch_object($result)) {

    // Load the node:
    $node = node_load(array(
      'nid' => $page->nid,
    ));
    if ($node) {

      // Take the most recent approved revision, extract the page and check output:
      $node = book_content($node, TRUE);

      // Output the content:
      $output .= '<div class="book">';
      $output .= '<div class="title">' . l($node->title, 'node/' . $node->nid) . '</div>';
      $output .= '<div class="body">' . $node->teaser . '</div>';
      $output .= '</div>';
    }
  }
  drupal_set_title(t('Books'));
  print theme('page', $output);
}