Tell me more ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I am rendering variables from a block array, but for some reason when I render a taxonomy term, I get the white screen of death.

after using views_get_view() to return an array, I can render anything I want from the array:

print render($product_header->field_field_product_screenshot); // works
print render($product_header->field_field_product_synopsis); // works
print render($product_header->field_field_taxonomy); // doesn't work

In the view settings, I am just outputting the field. No fanciness. The contents of the field_field_taxonomy array look similar to the other arrays (via dpm):

0 (Array, 2 elements)
rendered (Array, 5 elements)
raw (Array, 2 elements)

Why can't I render the taxonomy field?

share|improve this question
What's the $product_header object? – Clive Apr 26 at 15:35
It's the result of doing this: $view = views_get_view($view_name); $view->build($display_name); $view->execute($display_name); $result = $view->result; return $result; – Junie Threatt Apr 26 at 15:41
this also doesn't work field_view_field('block', $product_header, 'field_field_taxonomy'); – Junie Threatt Apr 26 at 16:20

1 Answer

You can custom your fields in views-view--[view name]--[display].tpl.php file

Example:

$fields = $view->style_plugin->rendered_fields;
foreach ($fields as $delta => $item){
    print $item['field_taxonomy'];
}

* assuming your field mashine name is "field_taxonomy"


Regarging to rendering fields with views_get_view('view_name') this might be helpful:

How can I render a result row using the Views API

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.