[documentation] general handbooks question
Neil Drumm
drumm at delocalizedham.com
Tue Jun 13 19:05:05 UTC 2006
Laura Scott wrote:
> I have a client who's looking to create documentation (for their own
> products) using the books module, who is wondering how the main
> handbooks sections pages have been set up. Is this done via php calls or
> manually? I'm assuming that each major section is its own book -- hence
> the changing navigation block, right? -- with that book's top level page
> using custom php calls, yes?
<?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;
}
?>
The rest is CSS.
(I'm guessing this is something that might be able to be coded into a
view in views module.)
--
Neil Drumm
http://delocalizedham.com/
More information about the documentation
mailing list