function _archive_page in Archive 5
- Fetch nodes for the selected date, or current date if none selected.
Parameters
$year: Number of year
$month: Number of month
$day: Number of day
Return value
A string with the themed page
1 call to _archive_page()
File
- ./
archive.inc, line 15
Code
function _archive_page($type = 'all', $year = NULL, $month = NULL, $day = NULL) {
$output = '';
$date = _archive_date($type, $year, $month, $day);
$nodes = variable_get('default_nodes_main', 10);
$query = _archive_query($type, $date);
$result = pager_query(db_rewrite_sql(array_shift($query)), $nodes, 0, NULL, $query);
if (db_num_rows($result)) {
// Set the page title for a proper archive page
drupal_set_title(theme('archive_page_title', $type, $year, $month, $day));
$output = theme('archive_navigation', $type, $date);
while ($node = db_fetch_object($result)) {
$output .= node_view(node_load($node->nid), TRUE);
}
$output .= theme('pager', NULL, $nodes);
return $output;
}
else {
if ($date->days[$date->day]) {
drupal_goto(_archive_url('all', $date->year, $date->month, $date->day));
}
else {
if ($date->months[$date->month]) {
drupal_goto(_archive_url('all', $date->year, $date->month));
}
else {
if ($date->years[$date->year]) {
drupal_goto(_archive_url('all', $date->year));
}
else {
if (arg(0) != 'archive') {
drupal_goto('archive');
}
else {
// Set the title for an empty archive page
drupal_set_title(t('Archive'));
$output = '<p>' . t('There\'s currently nothing in the archives to browse.') . '</p>';
return $output;
}
}
}
}
}
}