You are here

function book_export_html in Drupal 6

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

This function is called by book_export() to generate HTML for export.

The given node is /embedded to its absolute depth in a top level section/. For example, a child node with depth 2 in the hierarchy is contained in (otherwise empty) <div> elements corresponding to depth 0 and depth 1. This is intended to support WYSIWYG output - e.g., level 3 sections always look like level 3 sections, no matter their depth relative to the node selected to be exported as printer-friendly HTML.

Parameters

$nid: An integer representing the node id (nid) of the node to export.

Return value

A string containing HTML representing the node and its children in the book hierarchy.

1 string reference to 'book_export_html'
theme in includes/theme.inc
Generates the themed output.

File

modules/book/book.pages.inc, line 81
User page callbacks for the book module.

Code

function book_export_html($nid) {
  if (user_access('access printer-friendly version')) {
    $export_data = array();
    $node = node_load($nid);
    if (isset($node->book)) {
      $tree = book_menu_subtree_data($node->book);
      $contents = book_export_traverse($tree, 'book_node_export');
      return theme('book_export_html', $node->title, $contents, $node->book['depth']);
    }
    else {
      drupal_not_found();
    }
  }
  else {
    drupal_access_denied();
  }
}