I have something like the following:

<?php
function studiosundew_token_values($type, $object = NULL) {
  $values = array();
  switch ($type) {
    case 'node':
      $node = $object;
      $random_image = views_embed_view('random_image');
      $values['image-view'] = $random_image;
      break;
  }
  return $values;
}
?>

And I'm using the token filter module so I can add tokens like [token node image-view] into my node content. This works and a random image appears in my node. ALMOST perfect!

Any pointers as to how I can make it so that I can have multiple [token node image-view]s in each node, each one returning a new random image? At the moment, it simply repeats the same image.

Many thanks.

Comments

mshepherd’s picture

I got this working with multiple tokens, rather than multiple uses of the same token. So, tokens like [token node randomimage1], [token node randomimage1] and [token node randomimage3].

Dave Reid’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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