function book_export_html in Drupal 4
Same name and namespace in other branches
- 5 modules/book/book.module \book_export_html()
- 6 modules/book/book.pages.inc \book_export_html()
- 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
depth:
- an integer giving the depth in the book hierarchy of the node which is to be exported
Return value
- string containing HTML representing the node and its children in the book hierarchy
File
- modules/
book.module, line 702 - Allows users to collaboratively author a book.
Code
function book_export_html($nid, $depth) {
if (user_access('see printer-friendly version')) {
$node = node_load($nid);
for ($i = 1; $i < $depth; $i++) {
$content .= "<div class=\"section-{$i}\">\n";
}
$content .= book_recurse($nid, $depth, 'book_node_visitor_html_pre', 'book_node_visitor_html_post');
for ($i = 1; $i < $depth; $i++) {
$content .= "</div>\n";
}
return theme('book_export_html', check_plain($node->title), $content);
}
else {
drupal_access_denied();
}
}