or.... let's better phrase it.

I have 3 books on a site, and I want the 3 top pages always visible on the book block.

So far, with drupal 4.6.3, I can only see that block whem I am inside a book page.

What can I do to see it everywhere?

Thanks in advance!

Comments

denisr’s picture

ok, I think that I have to look at this code

/**
 * Implementation of hook_block().
 *
 * Displays the book table of contents in a block when the current page is a
 * single-node view of a book node.
 */
function book_block($op = 'list', $delta = 0) {
  $block = array();
  if ($op == 'list') {
    $block[0]['info'] = t('Book navigation');
    return $block;
  }
  else if ($op == 'view') {
    // Only display this block when the user is browsing a book:
    if (arg(0) == 'node' && is_numeric(arg(1))) { 
      $result = db_query(db_rewrite_sql('SELECT n.nid, n.title, b.parent FROM {node} n INNER JOIN {book} b ON n.nid = b.nid WHERE n.nid = %d'), arg(1));
      if (db_num_rows($result) > 0) {
        $node = db_fetch_object($result);

        $path = book_location($node);
        $path[] = $node;

        $expand = array();
        foreach ($path as $key => $node) {
          $expand[] = $node->nid;
        }

        $block['subject'] = check_plain($path[0]->title);
        $block['content'] = book_tree($expand[0], 5, $expand);
      }
    } 

    return $block;
 }
}

I tried to comment the if conditions, but still the block wont display. any other idea?