You are here

function theme_archive_page_title in Archive 7

Same name and namespace in other branches
  1. 5 archive.inc \theme_archive_page_title()
  2. 6 archive.pages.inc \theme_archive_page_title()
  3. 7.2 archive.pages.inc \theme_archive_page_title()

Theme function for the title of the archive page.

Parameters

$variables: An associative array containing:

  • type: The node type for the archive page.
  • year: The year of the archivepage.
  • month: The month of the archive page.
  • day: The day of the archive page.
1 theme call to theme_archive_page_title()
archive_page in ./archive.pages.inc
Fetch nodes for the selected date, or current date if none selected.

File

./archive.pages.inc, line 229
Pages for the archive module.

Code

function theme_archive_page_title($variables) {
  $title = t('Archive');
  $month_names = array(
    '',
    'Jan',
    'Feb',
    'Mar',
    'Apr',
    'May',
    'Jun',
    'Jul',
    'Aug',
    'Sep',
    'Oct',
    'Nov',
    'Dec',
  );
  if ($variables['day']) {
    $title .= ' - ' . t($month_names[$variables['month']]) . ' ' . $variables['day'] . ', ' . $variables['year'];
  }
  elseif ($variables['month']) {
    $title .= ' - ' . t($month_names[$variables['month']]) . ' ' . $variables['year'];
  }
  elseif ($variables['year']) {
    $title .= ' - ' . $variables['year'];
  }
  if ($variables['type'] != 'all') {
    $type_name = db_query("SELECT name FROM {node_type} WHERE type = '%s'", $variables['type'])
      ->fetchField();
    $title .= ' - ' . ($type_name ? t($type_name) : $variables['type']);
  }
  return $title;
}