Hi,

I have two taxonomies attached to a content type:

First taxonomy:
Meal - a taxonomy that the user can select only one term
Example terms are: Dinner, Launch, Breakfast

Second taxonomy:
Ocassion - a taxonomy that the user can select MORE than one term
Example: January, February, March, ...

I want in the teaser of this content, to show the taxonomies.

Something like this:

<span id="thmr_144" class="thmr_call">
 <div class="field field-type-text field-field-meal">
 <h3 class="field-label"><?php print "HERE THE MEAL TYPE THEY CHOOSE" ?></h2>
</div>
</span>

<span id="thmr_145" class="thmr_call">
 <div class="field field-type-text field-field-ocassion">
 <h3 class="field-label"><?php print "HERE THE OCASSION, separated by commas" ?></h2>
</div>
</span>

How can I retrieve this?

Thanks,

Andydev.

Comments

andydev’s picture

I managed to do this like this:

<?php
$taxo_id = 1;
$sql = "SELECT t.tid, t.* FROM term_data t INNER JOIN term_node r ON r.tid = t.tid WHERE t.vid =$taxo_id AND r.nid = $node->nid ORDER BY weight";

$result = db_query($sql);
while ($anode = db_fetch_object($result)) {
  $output .= $anode->name;
}
print $output;
?>

Is this the only way to do it? I tried doing it by using the taxonomy_node_get_terms_by_vocabulary function, but it seems I cannot use it from inside contemplate (I get function not found)

andydev’s picture

I still think this is a work around... there must be an easier way to do this...

Additionally, I have no idea how to make the terms linkable to their taxonomy.

Could anyone help please?