Views filter and taxonomy synonyms

newbuntu - January 21, 2008 - 20:40

Doesn't look like view filters work on synonyms.

e.g. I have a "semester" voc, and terms are "2008Spring, 2008Fall, 2007Fall, ..." and "current". I made "current" and "2008Spring" synonyms.

I set filter on "current", but those "2008Spring" nodes don't show up. I searched around, it looks like it's not supported.

Does anyone have any additional information?

Thanks in advance!

It's a little different than

rgraves - February 12, 2008 - 17:04

It's a little different than what you're asking for but I've used synonyms for arguments before. It's a little bit of a hack, but I wanted a way to use taxonomy terms in a URL without having to put + signs where there are spaces. Using synonyms allowed me to display a term like "American Literature" properly in the view's title with spaces and capitalization, but also use a URL like /subjects/americanliterature instead of /subjects/american+literature.

Here's the code I used in the argument handling code section:

if (isset($args[0])) {
// fetch terms based on the argument in the URL
$query = "select term_synonym.*, term_data.name as termname from term_synonym left join term_data on term_synonym.tid = term_data.tid where term_synonym.name = '". $args[0] ."'";
$result = mysql_query($query);
$data = mysql_fetch_assoc($result);

if (!empty($data['termname'])) {
   // if the argument is a synonym for another term, use the term's proper name
   $args[0] = $data['termname'];
}
else {
   // if there's no term with this synonym, than it must be just a regular term name
   $args[0] = ucwords($args[0]);
}
}

return $args;

Use the synonyms module to

cornmuffin - May 7, 2008 - 05:15

Use the synonyms module to enable search indexing of synonyms and then use the search index filter in views. I think this may work.

Taxonomy _redirect

Bilalx - December 24, 2008 - 13:21

Taxonomy _redirect module

current -> 2008Spring

 
 

Drupal is a registered trademark of Dries Buytaert.