Hi mate, sorry to point out another watchdog error:

Invalid argument supplied for foreach() in /../relevant_content/relevant_content_cck/theme/relevant_content_cck.theme.inc on line 26.

cheers

Comments

dakku’s picture

I think this tends to happen when there are no related nodes.
perhaps you should wrap your foreach loop with a check like this in line 26:

  // make sure we have something for the loop to avoid Invalid argument foreach() errors
  if($num_items > 1){
    // Loop over all the items and create the field output
    foreach ($element['items']['#item'] as $item) {
      $attributes = array('class' => 'field-item ' . ($count % 2 ? 'even' : 'odd'));
  
      // Append a "first" class to the row
      if ($count == 0) {
        $attributes['class'] .= ' first';
      }
  
      // Append a "last" class to the row
      if ($count == $num_items - 1) {
        $attributes['class'] .= ' last';
      }
  
      // Depending on the type, render a field
      switch ($type) {
        default:
        case 'default' :
          $result = l($item['title'], 'node/'. $item['nid']);
          break;
  
        case 'plain' :
          $result = check_plain($item['title']);
          break;
  
        case 'teaser' :
        case 'full' :
          $result = node_view(node_load($item['nid']), ($type == 'teaser'));
          break;
  
        case 'token_full' :
        case 'token_teaser' :
          // Run a token replace on the content
          $types = array('global' => NULL, 'node' => node_load($item['nid']));
          $result = token_replace_multiple($token_pattern, $types);
          break;
      }
  
      // Generate the field
      $output .= '<div'. drupal_attributes($attributes) .'>'. $result .'</div>';
      $count++;
    }
  }

nicholasthompson’s picture

There should be a fix for this committed recently... Can you try (cleanly) updating?

nicholasthompson’s picture

Status: Active » Needs review

Setting appropriate status

dakku’s picture

Status: Needs review » Fixed

seems fine in the latest cvs

Status: Fixed » Closed (fixed)

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