summaryrefslogtreecommitdiff
path: root/modules/taxonomy/taxonomy.module
diff options
context:
space:
mode:
Diffstat (limited to 'modules/taxonomy/taxonomy.module')
-rw-r--r--modules/taxonomy/taxonomy.module69
1 files changed, 35 insertions, 34 deletions
diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module
index 819194da4..0b20db1e4 100644
--- a/modules/taxonomy/taxonomy.module
+++ b/modules/taxonomy/taxonomy.module
@@ -855,44 +855,45 @@ function taxonomy_term_page($str_tids = '', $depth = 0, $op = 'page') {
drupal_not_found();
}
- // Build title:
- $result = db_query('SELECT name FROM {term_data} WHERE tid IN (%s)', implode(',', $tids));
- $names = array();
- while ($term = db_fetch_object($result)) {
- $names[] = $term->name;
- }
- $title = implode(', ', $names);
-
- switch ($op) {
- case 'page':
- // Build breadcrumb based on first hierarchy of first term:
- $current->tid = $tids[0];
- $breadcrumbs = array(array('path' => $_GET['q']));
- while ($parents = taxonomy_get_parents($current->tid)) {
- $current = array_shift($parents);
- $breadcrumbs[] = array('path' => 'taxonomy/term/'. $current->tid, 'title' => $current->name);
- }
- $breadcrumbs = array_reverse($breadcrumbs);
- menu_set_location($breadcrumbs);
-
- drupal_set_html_head('<link rel="alternate" type="application/rss+xml" title="RSS - '. $title .'" href="'. url('taxonomy/term/'. $str_tids .'/'. $depth .'/feed') .'" />');
+ if ($tids) {
+ // Build title:
+ $result = db_query('SELECT name FROM {term_data} WHERE tid IN (%s)', implode(',', $tids));
+ $names = array();
+ while ($term = db_fetch_object($result)) {
+ $names[] = $term->name;
+ }
+ $title = implode(', ', $names);
+
+ switch ($op) {
+ case 'page':
+ // Build breadcrumb based on first hierarchy of first term:
+ $current->tid = $tids[0];
+ $breadcrumbs = array(array('path' => $_GET['q']));
+ while ($parents = taxonomy_get_parents($current->tid)) {
+ $current = array_shift($parents);
+ $breadcrumbs[] = array('path' => 'taxonomy/term/'. $current->tid, 'title' => $current->name);
+ }
+ $breadcrumbs = array_reverse($breadcrumbs);
+ menu_set_location($breadcrumbs);
- $output = taxonomy_render_nodes(taxonomy_select_nodes($tids, $operator, $depth, TRUE));
- print theme('page', $output, $title);
- break;
+ drupal_set_html_head('<link rel="alternate" type="application/rss+xml" title="RSS - '. $title .'" href="'. url('taxonomy/term/'. $str_tids .'/'. $depth .'/feed') .'" />');
- case 'feed':
- $term = taxonomy_get_term($tids[0]);
- $channel['link'] = url('taxonomy/term/'. $str_tids .'/'. $depth, NULL, NULL, TRUE);
- $channel['title'] = variable_get('site_name', 'drupal') .' - '. $title;
- $channel['description'] = $term->description;
+ $output = taxonomy_render_nodes(taxonomy_select_nodes($tids, $operator, $depth, TRUE));
+ print theme('page', $output, $title);
+ break;
- $result = taxonomy_select_nodes($tids, $operator, $depth, FALSE);
- node_feed($result, $channel);
- break;
+ case 'feed':
+ $term = taxonomy_get_term($tids[0]);
+ $channel['link'] = url('taxonomy/term/'. $str_tids .'/'. $depth, NULL, NULL, TRUE);
+ $channel['title'] = variable_get('site_name', 'drupal') .' - '. $title;
+ $channel['description'] = $term->description;
- default:
- drupal_not_found();
+ $result = taxonomy_select_nodes($tids, $operator, $depth, FALSE);
+ node_feed($result, $channel);
+ break;
+ default:
+ drupal_not_found();
+ }
}
}