Clickable taxonomy fields
matthew_ellis24 - March 9, 2008 - 12:21
| Project: | CCK Taxonomy Fields |
| Version: | 5.x-1.2 |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
I may have misunderstood the purpose of this module. I'm trying to use it with advanced profile to allow users to select their interests from a list, and then click on their interests and see other users who share them. I can't seem to make the terms clickable though - is this something this module is meant to do, and if so how? If not what do I need instead?
Thanks
Matt

#1
I'm having the same problem at the moment...
#2
Same here
#3
Me too, is there a way to turn the terms into link?
#4
this would be great indeed!!
#5
That's the exact same question I was about to ask.
(I want to use taxonomy fields to let authors add links to taxonomy-based galleries within their content types)
Has somebody made any progress on that issue yet?
#6
Okay, I had a quick look on the module itself and hacked it so that it's working the way, I need it to.
It's quick and dirty, but it does the job for me, so if somebody is interested, here's the code.
Starting on line 173 I only changed the return value for $name inside the function cck_taxonomy_field_formatter as follows:
<?phpfunction cck_taxonomy_field_formatter($field, $item, $formatter, $node) {
switch ($formatter) {
default:
$name = db_result(db_query('SELECT name FROM {term_data} WHERE tid = %d', $item['tid']));
// workaround to create a link to the selected taxonomy term
// build url and return it
// attention! hardcoded path for image galleries
$myurl = 'http://'.$_SERVER['HTTP_HOST'].$GLOBALS['base_path'].'image/tid/'.$item['tid'];
$name = '<a href="'.$myurl.'">'.$name.'</a>';
return $name;
}
}
?>
The way my URL is build is very unflexible, as I hardcoded the path to match the URLs build by image_galley module.
I needed a quick solution and couldn't think of a nicer way.
Maybe it's a starting point for someone else to do more improvement on it.
Regards,
Daniel