function taxonomy_get_term_by_name

Same name and namespace in other branches
  1. 7.x drupal-7.x/modules/taxonomy/taxonomy.module \taxonomy_get_term_by_name()

Try to map a string to an existing term, as for glossary use.

Provides a case-insensitive and trimmed mapping, to maximize the likelihood of a successful match.

Parameters

name: Name of the term to search for.

Return value

An array of matching term objects.

1 call to taxonomy_get_term_by_name()
taxonomy_node_save in drupal-6.x/modules/taxonomy/taxonomy.module
Save term associations for a given node.

Archivo

drupal-6.x/modules/taxonomy/taxonomy.module, line 1022
Enables the organization of content into categories.

Código

function taxonomy_get_term_by_name($name) {
  $db_result = db_query(db_rewrite_sql("SELECT t.tid, t.* FROM {term_data} t WHERE LOWER(t.name) = LOWER('%s')", 't', 'tid'), trim($name));
  $result = array();
  while ($term = db_fetch_object($db_result)) {
    $result[] = $term;
  }

  return $result;
}