Views 2: Combine two multi-value fields per row Creating a content type on D6 about short-listed books for a competition. Each entry (book) in the short-list is a node, with fields for book-title, book-description, author-names (multi-value), author images (multi-value).

So in order to create the short-list I'm using views. I thought I could combine multi-value fields using Views 2 but I can't work out how. I wanted to show:


Book title
Book description
Author photo 1 [image]
Author name 1 [caption]
Author photo 2 [image]
Author name 2 [caption]
...


etc

How can I achieve this using Views 2 on D6?
Ah.  I gotcha now.  Drupal has no internal automagic way of knowing any connection between your author name and photo fields.  But, for display purposes at least, you can show them together by hacking at the CCK field template.

If you go into CCK module's directory, you will find a content-field.tpl.php file.  Copy it into your theme's directory and then COPY it to content-field-field_author_photo.tpl.php, eg, based upon the field name of your author's photo field name.  It is imperative that you COPY it, not just rename it, CCK needs both the base template and the specific field one.

By default, this bad boy looks like this:

&lt;?php if (!$field_empty) : ?&gt;
&lt;div class="field field-type-&lt;?php print $field_type_css ?&gt; field-&lt;?php print $field_name_css ?&gt;"&gt;
  &lt;?php if ($label_display == 'above') : ?&gt;
    &lt;div class="field-label"&gt;&lt;?php print t($label) ?&gt;:&amp;nbsp;&lt;/div&gt;
  &lt;?php endif;?&gt;
  &lt;div class="field-items"&gt;
    &lt;?php $count = 1;
    foreach ($items as $delta =&gt; $item) :
      if (!$item['empty']) : ?&gt;
        &lt;div class="field-item &lt;?php print ($count % 2 ? 'odd' : 'even') ?&gt;"&gt;
          &lt;?php if ($label_display == 'inline') { ?&gt;
            &lt;div class="field-label-inline&lt;?php print($delta ? '' : '-first')?&gt;"&gt;
              &lt;?php print t($label) ?&gt;:&amp;nbsp;&lt;/div&gt;
          &lt;?php } ?&gt;
          &lt;?php print $item['view'] ?&gt;
        &lt;/div&gt;
      &lt;?php $count++;
      endif;
    endforeach;?&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;?php endif; ?&gt;


and basically it wraps a CCK content field with lots of CSSable divs and so forth.  What you want to do is print out the author name under each photo, so you could do that by replacing the print $item['view'] (which is your photo) with something along the lines of this:

          &lt;?php print $item['view']; ?&gt;
          &lt;?php if (!empty($node-&gt;field_author_name[$delta]['value']): ?&gt;
             &lt;div class="author-photo-caption"&gt;
               &lt;?php print check_plain($node-&gt;field_author_name[$delta]['value']); ?&gt;
             &lt;/div&gt;
          &lt;?php endif; ?&gt;


And now when CCK builds this field, it will also grab the author name and put it under the photo.  It will of course still build the author name field and display it, so if that's not what you want, you can go in the Display Fields section of the node type config and exclude it from the $content variable and then it will only show up here.

Clear caches/theme registry and style up the author-photo-caption class and you should be set.  And now wherever this field is displayed, it will grab its counterpart (assuming no typos above :)

(Other assumptions:  field_author_photo and field_author_name are the names of your fields on your system.)