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
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

bflora - May 4, 2008 - 10:24

I'm having the same problem at the moment...

#2

thinguy - May 15, 2008 - 21:12

Same here

#3

eggthing - June 24, 2008 - 14:24

Me too, is there a way to turn the terms into link?

#4

pierrelord - July 8, 2008 - 22:59

this would be great indeed!!

#5

wentsch - October 13, 2008 - 12:27

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

wentsch - October 13, 2008 - 14:37
Component:Miscellaneous» Code

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:

<?php
function 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

 
 

Drupal is a registered trademark of Dries Buytaert.