summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2004-12-28 22:42:47 +0000
committerDries Buytaert <dries@buytaert.net>2004-12-28 22:42:47 +0000
commit5049c3e1e464155038824b3dd5ac83daf6fe0ee4 (patch)
treebba9a142b60004e00a7f67a7a657b0f00ecaa6b0
parentf4dfafe860cc9cb2d0356676dba4f20987e2dd22 (diff)
downloadbrdo-5049c3e1e464155038824b3dd5ac83daf6fe0ee4.tar.gz
brdo-5049c3e1e464155038824b3dd5ac83daf6fe0ee4.tar.bz2
- Reorganized the code a bit
-rw-r--r--modules/taxonomy.module72
-rw-r--r--modules/taxonomy/taxonomy.module72
2 files changed, 74 insertions, 70 deletions
diff --git a/modules/taxonomy.module b/modules/taxonomy.module
index 19ececa09..6984d4d46 100644
--- a/modules/taxonomy.module
+++ b/modules/taxonomy.module
@@ -906,42 +906,44 @@ function taxonomy_term_page($str_tids = '', $depth = 0, $op = 'page') {
while ($term = db_fetch_object($result)) {
$names[] = $term->name;
}
- if (count($names) == 0) {
- drupal_not_found();
- return;
- }
- drupal_set_title($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') .'" />');
-
- $output = taxonomy_render_nodes(taxonomy_select_nodes($tids, $operator, $depth, TRUE));
- $output .= theme('xml_icon', url("taxonomy/term/$str_tids/$depth/feed"));
- print theme('page', $output);
- 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;
- $result = taxonomy_select_nodes($tids, $operator, $depth, FALSE);
- node_feed($result, $channel);
- break;
- default:
- drupal_not_found();
+ if ($names) {
+ drupal_set_title($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') .'" />');
+
+ $output = taxonomy_render_nodes(taxonomy_select_nodes($tids, $operator, $depth, TRUE));
+ $output .= theme('xml_icon', url("taxonomy/term/$str_tids/$depth/feed"));
+ print theme('page', $output);
+ 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;
+
+ $result = taxonomy_select_nodes($tids, $operator, $depth, FALSE);
+ node_feed($result, $channel);
+ break;
+ default:
+ drupal_not_found();
+ }
+ }
+ else {
+ drupal_not_found();
}
}
}
diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module
index 19ececa09..6984d4d46 100644
--- a/modules/taxonomy/taxonomy.module
+++ b/modules/taxonomy/taxonomy.module
@@ -906,42 +906,44 @@ function taxonomy_term_page($str_tids = '', $depth = 0, $op = 'page') {
while ($term = db_fetch_object($result)) {
$names[] = $term->name;
}
- if (count($names) == 0) {
- drupal_not_found();
- return;
- }
- drupal_set_title($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') .'" />');
-
- $output = taxonomy_render_nodes(taxonomy_select_nodes($tids, $operator, $depth, TRUE));
- $output .= theme('xml_icon', url("taxonomy/term/$str_tids/$depth/feed"));
- print theme('page', $output);
- 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;
- $result = taxonomy_select_nodes($tids, $operator, $depth, FALSE);
- node_feed($result, $channel);
- break;
- default:
- drupal_not_found();
+ if ($names) {
+ drupal_set_title($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') .'" />');
+
+ $output = taxonomy_render_nodes(taxonomy_select_nodes($tids, $operator, $depth, TRUE));
+ $output .= theme('xml_icon', url("taxonomy/term/$str_tids/$depth/feed"));
+ print theme('page', $output);
+ 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;
+
+ $result = taxonomy_select_nodes($tids, $operator, $depth, FALSE);
+ node_feed($result, $channel);
+ break;
+ default:
+ drupal_not_found();
+ }
+ }
+ else {
+ drupal_not_found();
}
}
}