diff --git a/modules/taxonomy.module b/modules/taxonomy.module index 819194da4d0f139fd7bedbc9cfcf6d6a4ec48e54..0b20db1e49f1acb43f58429ff598e9c97d834d85 100644 --- a/modules/taxonomy.module +++ b/modules/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(); + } } } diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module index 819194da4d0f139fd7bedbc9cfcf6d6a4ec48e54..0b20db1e49f1acb43f58429ff598e9c97d834d85 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(); + } } }