I want to add some info to the taxonomy_term_page (path taxonomy/term/TID).
One simple solution is to add it directly inside the taxonomy_term_page() function but this makes it hard to maintain across updates of the taxonomy module etc.
So I would like a way to accomplish this from a separate module similar to what can be done to nodes with hook_nodeapi().
As a first atempt I tried this:
First i "override" the menu settings in my test.module
$items[] = array('path' => 'taxonomy/term',
'title' => t('Taxonomy term'),
'callback' => 'test_term_page',
'access' => user_access('access content'),
'type' => MENU_CALLBACK
);
And in the callback i add my xtra info and calls the original taxonomy_term_page() function
function test_term_page() {
$tid = arg(2);
$result = db_query(db_rewrite_sql('SELECT description FROM {term_data} WHERE tid=%d'), $tid);;
$data = db_fetch_object($result);
$output = '<div class="term-description">' . $data->description . '</div>';
print theme('page', $output . taxonomy_term_page($tid));
}
If you don't want to affect all vocabularies I guess the module field of the vocabulary table togehter with taxonomy_term_path() function could be useful but I've not tried this.