Вы здесь

Друпал 7: book-export-html.tpl.php

book-export-html.tpl.php — шаблон формирующий версию для печати (в книгах).

Переменные

  • $title — заголовок книги (заголовок верхнего документа)
  • $head — HTML-теги книги
  • $language — код языка (например ru для русского)
  • $language_rtl — возвращает значение 1 (TRUE, если в языке используется письмо справа налево) или 0 (FALSE, если в языке используется письмо слева направо)
  • $base_url — адрес первой страницы
  • $contents — содержание книги (документы входящие в текущую книгу, в обработке book-node-export-html.tpl.php

Пример шаблона

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="<?php print $language->language; ?>" xml:lang="<?php print $language->language; ?>">
  <head>
    <title><?php print $title; ?></title>
    <?php print $head; ?>
    <base href="<?php print $base_url; ?>" />
    <link type="text/css" rel="stylesheet" href="misc/print.css" />
    <?php if ($language_rtl): ?>
      <link type="text/css" rel="stylesheet" href="misc/print-rtl.css" />
    <?php endif; ?>
  </head>
  <body>
    <?php
   
/**
     * 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) &lt;div&gt; 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.
     */
   
$div_close = '';
   
?>

    <?php for ($i = 1; $i < $depth; $i++) : ?>
      <div class="section-<?php print $i; ?>">
      <?php $div_close .= '</div>'; ?>
    <?php endfor; ?>
    <?php print $contents; ?>
    <?php print $div_close; ?>
  </body>
</html>