I'll like my books navigation to look like something like http://drupal.org/handbooks, where books are tucked neatly in categories. How can I do that?

Comments

sepeck’s picture

with a php script

// Book nids and their titles
$books = array(257 => "Customization - Tutorials, Snippets and HowTo", 509 => "Theme Developers' Guide", 316 => "Developing for Drupal");

foreach ($books as $nid => $title) {
  print '<h2 style="clear: left;">'. l($title, 'node/'. $nid) .'</h2>';
  // Fetch first level children
  $result = db_query("SELECT DISTINCT b.nid, n.title FROM {book} b INNER JOIN {node} n ON b.vid = n.vid WHERE b.parent = %d AND n.moderate = 0 AND n.status = 1 ORDER BY b.weight, n.title ASC", $nid);

  // Output pretty two-column list
  $half = ceil(db_num_rows($result) / 2); $i = 0;
  $section = '<div class="column-left"><ul>';
  while ($page = db_fetch_object($result)) {
    $section .= '<li>'. l($page->title, 'node/'. $page->nid) .'</li>';
    $i++;
    if ($i == $half) { 
      $section .= '</ul></div><div class="column-right"><ul>';
    }
  }
  $section .= '</ul></div>';
  print $section;
}

-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide -|- Black Mountain

-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide