I am using Views 2. I created a view called 'splogs' and a template called 'views-view-fields--splogs.tpl.php' in order to customize the output.

I have been able to output term name field by using <?php print $fields['tid']->content;?> .

But, how do I output that term's id? I have looked at all the available fields in Theme Information, and at the data in the $row variable (no taxonomy information available in $row).

Any suggestions? Thanks

Comments

merlinofchaos’s picture

This one can be a little tough, normally tids aren't exposed. You might be forced to look in $view->result -- that may well contain a tid. If it does not, I'm not sure you'll be able to get one without writing a field handler for that purpose.

apersaud’s picture

Instead of getting the tid of the term through the view, I decided to get it through the node:

 /* get term*/
 $vid1 = 4; //  vocabulary id
 $terms = taxonomy_node_get_terms_by_vocabulary($node, $vid1, $key = 'tid');
 if ($terms) {
  foreach ($termss as $key => $termchild) {
  $term = ($termchild->name);
	$term_tid = ($termchild->tid);
  }
 }
merlinofchaos’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.