I have spent some hours on this with no luck. It would seem to be a simple matter and I hope has a simple answer.

I created a page view called "regret" to list nodes in a certain vocabulary. The view has fields Title, Teaser and Taxonomy: All terms

When I preview this on Live Preview, I see all 3 fields mentioned above. But when I try to theme it using views-view-fields--regrets--page.tpl.php in my themes directory with print_r($row) I only see

stdClass Object ( [nid] => 69 [node_title] => I cheated on my driver's license test [node_revisions_teaser] => Phasellus at lacinia massa. [node_revisions_format] => 1 [node_vid] => 69 )

How do I access the Taxonomy: All terms field?

Thanks in advance for any help.
Lakshmi

Comments

merlinofchaos’s picture

Status: Active » Fixed

Because it's a many to one relationship, the results for that field are loaded via a secondary query in the pre_render() method of the field handler.

When handlers do this, they store their data on themselves, rather than in the result object. You can look on $view->field[$field_id] -- and if you look in modules/taxonomy at the field handler for the all terms field (I can't remember what it's called offhand but it should be easy to find) and check out it's pre_render() method to see exactly how it stores its data.

lakshmi_drupal2’s picture

Okay, that sort of went over my head, I only have a vague idea of field handlers, etc. However I think I got lucky with some hints from your reply. In view-fields--regrets--page.tpl.php this code seems to gives me all the data I want:

print "nid:$row->nid<br />title:$row->node_title<br />teaser:$row->node_revisions_teaser<br />";
print "terms:" . $fields['tid']->content . "<br /><br /><br />";

Thanks.

Status: Fixed » Closed (fixed)

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