Please can someone help with this. I have a very simple site and taxonomy. The taxonony is:
1) News
1.1) US
1.2) Europe
1.3) Rest of World
2) Sport
2.1) Football
2.2) Baseball
etc.
Whenever I create a new node you can only select one taxonomy term. For instance News-Rest of World.
In this case the term is Rest of World and the parent is News.
My primary links are simply driven off the taxonomy eg, by linking to taxonomy/term/3/all
where term 3 is News. This displays a list of all the nodes filed under US, Europe of Rest of World. Using either theme_links or displaying the primary links as a menu block I can generate an active class allowing me to highlight the primary link the tab falls under
The problem is when I click on a single node. This node will have been filed under "Rest of World" but when I display the full node the primary link loses its tab.
I have developed a workaround to query the database to find the parent and I can overide theme_links() to highlight the tab. The query code is stored in the page-node.tpl.php file and is:
$result = db_result(db_query("SELECT tid FROM {term_node} WHERE nid = $node->nid"));
$result2 = db_result(db_query("SELECT h.parent, d.tid FROM {term_data} d INNER JOIN {term_hierarchy} h ON d.tid = h.tid WHERE d.tid = $result"));