How to know, if on taxonomy page? Possible Duplicate:
  Check if current page is taxonomy term  




For now, I use something like this to decide, if I'm on a taxonomy page.

if (arg(0) == 'taxonomy' &amp;&amp; arg(1) == 'term' &amp;&amp; is_numeric(arg(2))) {
   $tid = intval(arg(2));
   $parents = taxonomy_get_parents($tid);
   $term = $parents[0];

   ...
}


Is there a more elegant way to decide, if I'm on a taxonomy page than this arg(0), arg(1), arg(2) thing? 
Same would apply to a node page if (arg(0) == 'node' &amp;&amp; is_numeric(arg(1))).

I didn't find any reference in the net. But maybe I ask the wrong questions.
You could try menu_get_object(), it's slightly cleaner:

$term = menu_get_object('taxonomy_term', 2);
if ($term) {
  // You're on a term page and have the loaded object in $term
}