I want to show the node title and related taxonomy terms in a table and modifying the search-result.tpl.php to do this.
What I use to for taxonomy terms is that:
<td class="field-item"> <?php $str = ''; foreach($result['node']->field_my_taxonomy_term['und'] as $obj) $str .= l($obj['taxonomy_term']->name, 'taxonomy/term/' . $obj['tid']) . ', '; print trim($str, ', '); ?> </td>
This code works in one of my Drupal website and doesn't work on another one and gives this error:
Notice: include() (.../search-result.tpl.php line 20) Undefined index: und. Warning: include() (.../search-result.tpl.php line 20) Invalid argument supplied for foreach().
How can I show the taxonomy terms related to the node in search-result.tpl.php?