You are here

function print_controller_html in Printer, email and PDF versions 5.x

Same name and namespace in other branches
  1. 5.4 print.pages.inc \print_controller_html()
  2. 5.3 print.pages.inc \print_controller_html()
  3. 6 print.pages.inc \print_controller_html()
  4. 7.2 print.pages.inc \print_controller_html()
  5. 7 print.pages.inc \print_controller_html()

Generate an HTML version of the printer-friendly page

See also

print_controller()

1 string reference to 'print_controller_html'
print_menu in ./print.module
Implementation of hook_menu().

File

./print.pages.inc, line 21

Code

function print_controller_html() {
  $args = func_get_args();
  $path = implode('/', $args);
  $cid = isset($_GET['comment']) ? (int) $_GET['comment'] : NULL;
  $print = print_controller($path, $cid, PRINT_HTML_FORMAT);
  if ($print !== FALSE) {
    $node = $print['node'];
    $html = theme('print_page', $print, PRINT_HTML_FORMAT, $node);
    $html = drupal_final_markup($html);
    print $html;
    $nodepath = isset($node->path) ? drupal_get_normal_path($node->path) : 'node/' . $path;
    db_query("UPDATE {print_page_counter} SET totalcount = totalcount + 1, timestamp = %d WHERE path = '%s'", time(), $nodepath);

    // If we affected 0 rows, this is the first time viewing the node.
    if (!db_affected_rows()) {

      // We must create a new row to store counters for the new node.
      db_query("INSERT INTO {print_page_counter} (path, totalcount, timestamp) VALUES ('%s', 1, %d)", $nodepath, time());
    }
  }
}