Get Tags from Specific Category in WordPress

Found a recipe from wprecipes about how to get tags specific from a category in WordPress. But that example didn’t include outputting the tags as links with number of counts. So I modified it a little to fit my needs and add this new function to my functions.php:


function MyTagList($categoryName) {
query_posts('category_name='.$categoryName);
if (have_posts()) : while (have_posts()) : the_post();
$posttags = get_the_tags();
if ($posttags) {
//making $all_tags_arr A MULTI-DIMENSIONAL ARRAY
foreach($posttags as $key => $tag) {
  $all_tags_arr[$key]['name'] = $tag -> name;
  $all_tags_arr[$key]['count'] = $tag -> count;
  $all_tags_arr[$key]['link'] = get_tag_link($tag -> term_id);
}
}
endwhile; endif;

echo "<h4>Tags</h4>\n";
echo "<ul>\n";
foreach($all_tags_arr as $tag) {
  echo "<li><a href='".$tag['link']."'>\n";
  echo $tag['name'];
  echo "</a> (".$tag['count'].") </li>\n";
}
echo "</ul>\n";

}

Then I just need to call this function with the specific category that I want my tags from:


<?php MyTagList('mySpecificCategory'); ?>