Get nodes affiliated/connected to a taxonomy term

I'm writing this to extend the knowledge-base and I hope people can Google this, because I wasn't able to find something about it. Apologies if this is not the right spot.
Search strings
Get active node in taxonomy term page
preprocess_page get active node
Problem:
Using products within the taxonomy menu module, I set header images within a content-type which is a node. I then use the reference field to connect the product to a taxonomy term. In my page.tpl.php I need to be able to read out the 'header_image' variable set in the node. $node is by default always available, but not when you're on for example, a taxonomy term's page. There can be several nodes connected to a taxonomy term, which is the reason why Drupal doesn't know the active node and therefore the $node variable is not set. In my case however, I use only one product per taxonomy term, so in practice there is only one node connected to one term. I needed to get the header_image var from the active node within the page.tpl.php.
Solution:
1. First get the active taxonomy term:
$term = taxonomy_term_load(arg(2)); $termid = arg(2); $term = taxonomy_term_load($termid);
2. Then get the nodes affiliated with this term:
$nodeid = taxonomy_select_nodes($term->tid);
3. Then simply use node_load to grab all the elements fom that node
$result = node_load($nodeid);