book_export
modules/book/book.pages.inc, строка 41
- Версии
- 5
book_export($type = 'html', $nid = 0)
- 6
book_export($type, $nid)
Menu callback; Generates various representation of a book page and its children.
The function delegates the generation of output to helper functions.
The function name is derived by prepending 'book_export_'
to the
given output type. So, e.g., a type of 'html'
results in a call to
the function book_export_html()
.
- html: HTML (printer friendly output)
Параметры
$type
A string encoding the type of output requested. The following
types are currently supported in book module:
$nid
An integer representing the node id (nid) of the node to export
Возвращаемое значение
A string representing the node and its children in the book hierarchy
in a format determined by the $type
parameter.
Код
<?php
function book_export($type, $nid) {
$type = drupal_strtolower($type);
$export_function = 'book_export_'. $type;
if (function_exists($export_function)) {
print call_user_func($export_function, $nid);
}
else {
drupal_set_message(t('Unknown export format.'));
drupal_not_found();
}
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии