You are here

function _print_get_title in Printer, email and PDF versions 5.4

Same name and namespace in other branches
  1. 6 print.module \_print_get_title()
  2. 7.2 print.module \_print_get_title()
  3. 7 print.module \_print_get_title()
  4. 5.x print.module \_print_get_title()

Auxiliary function to discover a given page's title

Parameters

$path: path of the page being identified

Return value

string with the page's title

4 calls to _print_get_title()
print_block in ./print.module
Implementation of hook_block().
print_mail_block in print_mail/print_mail.module
Implementation of hook_block().
print_mail_form in print_mail/print_mail.inc
Menu callback for the send by e-mail form.
print_pdf_block in print_pdf/print_pdf.module
Implementation of hook_block().

File

./print.module, line 440
Displays Printer-friendly versions of Drupal pages.

Code

function _print_get_title($path) {
  $path = drupal_get_normal_path($path);
  $nid = preg_replace('!^node/!', '', $path);
  if (is_numeric($nid)) {
    $res = db_fetch_object(db_query("SELECT title FROM {node} WHERE nid = %d", $nid));
    return $res->title;
  }
  else {
    $res = db_fetch_object(db_query("SELECT title FROM {menu} WHERE path = '%s'", $path));
    if ($res) {
      return $res->link_title;
    }
    else {
      return NULL;
    }
  }
}