3

I have a view that for each row, outputs the first 3 images of a CCK image field.

I would like to be able to Output a different link for each image in the format node/[nid]?image=[delta]

I don't mind writing a token for this purpose, although I'm not sure how I'd access the delta number in the first place, other that some convoluted loop that just increments and resets a static variable, and even then, would that even work or is there some sort of token caching that would break even that approach?

1 Answer 1

2

Depending on the views version you use, you have different options to render a multiple values field and the fields themselves.

The easiest thing in this case would be to create a special field formatter for the images. Field formatters are almost exactly same for both Drupal 6 and 7 and is what you could call a theme function for fields. In that theme function you would be able to handle the different deltas, as you will have that variable accessible.

  • This post explains a bit about field formatters.
  • This post explains how to create a field formatter (D6).
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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