book_export

Хочешь помочь с переводом? Это очень просто и быстро. Лишь зарегистрируйся, и можешь тут же начать переводить.

modules/book/book.module, строка 639

Версии
5
book_export($type = 'html', $nid = 0)
6
book_export($type, $nid)

Menu callback; Generates various representation of a book page with all descendants and prints the requested representation to output.

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().

Параметры

type

  • a string encoding the type of output requested. The following types are currently supported in book module html: HTML (printer friendly output) Other types are supported in contributed modules.
nid
  • an integer representing the node id (nid) of the node to export

Код

<?php
function book_export($type = 'html', $nid = 0) {
  $type = drupal_strtolower($type);
  $node_result = db_query(db_rewrite_sql('SELECT n.nid, n.title, b.parent FROM {node} n INNER JOIN {book} b ON n.vid = b.vid WHERE n.nid = %d'), $nid);
  if (db_num_rows($node_result) > 0) {
      $node = db_fetch_object($node_result);
  }
  $depth = count(book_location($node)) + 1;
  $export_function = 'book_export_'. $type;

  if (function_exists($export_function)) {
    print call_user_func($export_function, $nid, $depth);
  }
  else {
    drupal_set_message(t('Unknown export format.'));
    drupal_not_found();
  }
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии

Вход в систему