How to print multi-value link image CCK field in template? I have a multi-value CCK field set up using the Link Image Field module, and I need to print all of the images (linked) on the content page. I used the code below to print the images themselves, but cannot figure out how to wrap each image's link around each image.

                &lt;?php if ($node-&gt;field_day_option_buttons[0]['filepath']): ?&gt;
             &lt;?php
                foreach($node-&gt;field_day_option_buttons as $image) {
                 if (file_exists($image['filepath'])) {
                     print theme_imagecache('my image cache preset name', $image['filepath']);
                    }
                  }
              ?&gt;
            &lt;?php endif; ?&gt;


Can anyone provide input on how to accomplish that?

Thanks!

EDIT
Here is the info placed on the page when I run a print(r) on that cck field:

Array ( 
  [0] =&gt; Array ( 
    [fid] =&gt; 347
    [uid] =&gt; 1
    [filename] =&gt; days-5.png
    [filepath] =&gt; sites/default/files/days-5_0.png
    [filemime] =&gt; image/png
    [filesize] =&gt; 440
    [status] =&gt; 1
    [timestamp] =&gt; 1366038083
    [list] =&gt; 1
    [data] =&gt; Array (
       [alt] =&gt; Alt Text
       [title] =&gt; Title Text
       [url] =&gt; http://www.mysite.com
       [target] =&gt; _self
    ) 
    [nid] =&gt; 18
  )
  [1] =&gt; Array (
    [fid] =&gt; 348
    [uid] =&gt; 1
    [filename] =&gt; days-20.png
    [filepath] =&gt; sites/default/files/days-20_0.png
    [filemime] =&gt; image/png
    [filesize] =&gt; 506
    [status] =&gt; 1
    [timestamp] =&gt; 1366038108
    [list] =&gt; 1
    [data] =&gt; Array (
       [alt] =&gt; Alt Text
       [title] =&gt; Title Text
       [url] =&gt; http://www.mysite.com
       [target] =&gt; _self
     )
    [nid] =&gt; 18
  )
)
You should be able to use the l() function (link function) to print out your link.

Typically, l() is used with the arguments l("My link text", $path), however, the first argument doesn't have to be text and can be just html.  You just have to specify that with the optional $options array argument at the end if you're including html.  :-)

Here is more documentation on using l(): http://api.drupal.org/api/drupal/includes!common.inc/function/l/7  The 6 &amp; 7 versions should work similarly.

In your case, you can build your link like this: 


Your first argument will be an image, rather than text as the link
Your second argument will be the path you want the image to link to, which should be $image['filepath']
Your third argument should specify that the first argument is html, and not just text


So, try something like:

&lt;?php
print l(  
    theme_imagecache('my image cache preset name', $image['filepath']),
    $image['data']['url'],
    array(
          'attributes' =&gt; array(   // Sample attributes you can apply to your anchor tag
            'id' =&gt; 'your-link-id',
            'class' =&gt; 'your-link-class',
            'target' =&gt; '_blank',  // open link in new window.
          ), 
        'html' =&gt; true,
    )
);
?&gt;


I haven't tested this yet, as I don't have a Drupal 6 site handy, but this should work.  Let us know if it works or if it needs some tweaking...