Where can i find a description of the structure of the vocabulary object?
I want to get an array of nodes ordered by their vocabularyterm (all nodes have 1 term of the vocabulary) :
<?php array ( Vocabulary_term1 => array( node1_nid, node2_nid), Vocabulary_term2 => array( node3_nid, node4_nid, node5_nid), ...) ?>
first i load the vocabulary object:
<?php $vocabulary = taxonomy_vocabulary_load(1); //1 is the vocabulary vid ?>
Now i want to loop all terms:
<?php
$nodes_array = array();
foreach ($vocabulary->tids as $tid) { // !! $vocabulary->tids is just a guess !!
$nodes_array[$tid]=array();
while ($result = taxonomy_select_nodes($tid)) {
$nodes_array[$tid][] = $result->nid; // !! how do i get the nid from the result? !!
}
?>
EDIT i've done some php coding to get the keys of the vocabulary object:
vid name description help relations hierarchy multiple required tags module weight language nodes
there doesn't seem to be an array of terms in this object...
thanks!
Comments
SOLVED WITH QUERIES
thanks to Benjamin Lowenstein, Colingo Labs LLC : http://benl.com/node/20 for the code example