85a86
>   // Read arguments
93a95
>     
106a109,118
>   
>   // Make list of current parents for breadcrumbs
>   
>   $all_parents = array();  
>   foreach($terms as $tid=>$name) {  
> 	  $parents = taxonomy_get_parents($tid);
>     foreach ($parents as $parent) {
>       $all_parents[$parent->tid] = l($parent->name, 'links/weblink/'.$parent->tid);
>     }
>   }
108,109c120,148
<   $all_parents = array();
<   foreach ($terms as $tid=>$name) {
---
>   // Handle breadcrumbs
>     
>   if ($top_level) {
>     drupal_set_title(t('Weblinks Top Level'));
>   } else {
>     drupal_set_title(t('Weblinks: %topics', array('%topics'=>implode(', ',$terms))));
>     $breadcrumbs = drupal_get_breadcrumb();
>     $breadcrumbs[] = l(t('Weblinks top level'), 'links/weblink');
>     if (count($all_parents)) {
>       $breadcrumbs[] = implode(', ', $all_parents);
>     }
>     drupal_set_breadcrumb($breadcrumbs);
>   }  
>   
>   // Find which categories to list
>   
>   if($top_level)
>   	$categories_to_list = $terms;
>   else {
>   	$categories_to_list = array();
>   	$children_categories = taxonomy_get_children($tid);
>   	foreach ($children_categories as $children_category) {
>   		$categories_to_list[$children_category->tid] = $children_category->name;
>   	}
>   }
>   
>   // List categories
>   
>   foreach ($categories_to_list as $tid=>$name) {
132,135d170
<     $parents = taxonomy_get_parents($tid);
<     foreach ($parents as $parent) {
<       $all_parents[$parent->tid] = l($parent->name, 'links/weblink/'.$parent->tid);
<     }
138,150c173
< 
<   if ($top_level) {
<     drupal_set_title(t('Weblinks Top Level'));
<   } else {
<     drupal_set_title(t('Weblinks: %topics', array('%topics'=>implode(', ',$terms))));
<     $breadcrumbs = drupal_get_breadcrumb();
<     $breadcrumbs[] = l(t('Weblinks top level'), 'links/weblink');
<     if (count($all_parents)) {
<       $breadcrumbs[] = implode(', ', $all_parents);
<     }
<     drupal_set_breadcrumb($breadcrumbs);
<   }
< 
---
>   
151a175,186
>   
>   $terms_to_list = array();
>   if(variable_get('links_weblink_catalog_show_child_category_links','1')) {
>     $terms_to_list = $terms;
>     if (!$top_level) {
>       $terms_to_list += $categories_to_list;
>     }
>   } else {
>     if (!$top_level)
>       $terms_to_list[$tid] = $term;   
>   }  
>   
156c191
<   if (count($terms)) {
---
>   if (count($terms_to_list)) {
158c193
<     $result = db_query($sql, implode(',', array_keys($terms)));
---
>     $result = db_query($sql, implode(',', array_keys($terms_to_list)));
188c223
<   }
---
>   }  
200c235,236
<   $output .= '<h1>' . t('Categories') . '</h1>';
---
>   $categories_listed = false;
>   
202a239
>     	$categories_listed = true;
223c260,265
<   $output .= theme('table',NULL,$table);
---
>   
>   if($categories_listed) {
> 	  $output .= '<h1>' . t('Categories') . '</h1>';
> 	  $output .= theme('table',NULL,$table);
>   }
>     
224a267
>   $links_listed = false;
226a270
>     	$links_listed = true;
229a274,276
>   if(!$links_listed)
>   	$output .= '<p>' . t('No links found in this category') . '</p>';
> 	
306a354,361
>   );
>   
>   $form['link_catalog']['links_weblink_catalog_show_child_category_links'] = array(
>     '#type' => 'checkbox',
>     '#title' => t('Show links in child categories'),
>     '#return_value' => 1,
>     '#default_value' => variable_get('links_weblink_catalog_show_child_category_links','1'),
>     '#description' => t('If enabled, the weblink catalog will list weblinks in both the selected category and its children (if the vocabulary in use is hierarchical).'),
