You are here

function taxonomy_edge_get_max_depth in Taxonomy Edge 6

Same name and namespace in other branches
  1. 8 taxonomy_edge.module \taxonomy_edge_get_max_depth()
  2. 7.2 taxonomy_edge.module \taxonomy_edge_get_max_depth()
  3. 7 taxonomy_edge.module \taxonomy_edge_get_max_depth()

Get max depth of a tree..

Parameters

$vid: Vocabulary ID

$parent (optional): Parent to max depth of

Return value

Max depth (distance)

File

./taxonomy_edge.module, line 669
Selecting all children of a given taxonomy term can be a pain. This module makes it easier to do this, by maintaining a complete list of edges for each term using the adjecency matrix graph theory.

Code

function taxonomy_edge_get_max_depth($vid, $parent = 0) {
  return db_result(db_query("SELECT MAX(distance) FROM {term_edge} WHERE vid = %d AND parent = %d", $vid, $parent));
}