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
  • Awesome worked very nicely, although I found the following link a little more helpful, simply because it was written with more of an example to go with it, but thank you very much for lighting the way :) manueg.okkernoot.net/blog/200907/how-create-cck-formatter Commented Jul 5, 2011 at 14:06

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.