Im looking for the source code on how Drupal.org/handbooks page in created. I found it before searching through the forums in like 5mins but this time i just spent 40mins and i still cant find it. Thanks in advance.

Comments

vigo-1’s picture

The handbooks were created using the book module.

Steven’s picture

Here is the PHP:

// Book nids and their titles
$books = array(1 => "About Drupal", 258 => "Installation and configuration", 257 => "Customization and theming", 316 => "Developing for Drupal", 14279 => "About Drupal documentation");

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 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;
}

--
If you have a problem, please search before posting a question.