How to replace the $title of one single page with a taxonomy term? My setting here is like this:

I have a huge Druapl site here, and there's one single page that contains a views block displaying uploaded files with their taxonomy terms in a table. Title of this page is "Uploaded files".

Clicking on of these taxonomy terms calls the URL plus an additional query ?tid=123 applying a filter for that term on the table. So now only content of taxonomy tid 123 is displayed in the table and the URL ends with ?tid=123.

In that situation I want the title "Uploaded files" to be replaced by "Files of the taxonomy term 123", where 123 stands for the actual term connected to the tid 123. Let it be "To-Do-List".

Inside my theme's template folder I created a template file for that single page called page--node--nid.tpl.php, where nid stands for the actual node id of that page. I'm quite well able to manipulate the title of that page now when clicked on a term. At the place where the title is printed I can say &lt;?php print $_GET['tid'] ?&gt; and of course instead of "Uploaded files" it now prints the tid, here in my example: 123.

But how do I get the template to print the term instead of the id?

I know that there's a function called taxonomy_term_load to load the term connected with an id. But where would I call that function? And how do I pass maybe newly created $taxonomy_title into my page--node--nid.tp.php? Do I have to call some preprocess functions within the  tags at the top of my page--node--nid.tpl.php?

To make matters even more difficult, there are terms from different vocabularies. In my example it sets the query to ?tid=123, but when I click on a term from another vocabulary it sets the query to ?tid_1=234

I came so far on my own, but do really very much appreciate a helping explanation on how and where to use that function...
You can achievie that with contextual filters as well.

contextual filter: Content: Has taxonomy term ID

When the filter value is NOT available: 


provide default value -> type: Taxonomy term ID from URL
Load default filter from node page, that's good for related taxonomy
blocks
check the vocabulary which you want to use


When the filter value IS available or a default is provided:

Specify validation criteria -> PHP Code

$term = taxonomy_term_load($argument);
drupal_set_title($term-&gt;name);
return $argument;


It's done!