Making CCK Image in View Link To Node

ghumpley - March 31, 2008 - 21:24

OK, this seems pretty simple but it's driving me nuts!

I've got a CCK node type on one of my sites where I've got an image field. I've then made a view for those nodes that includes the node title and the cck image. But how can I make the image link to the node?

Is there a way, through views theming, to do this? I can make the node title a link to the node, or create a link to the node with custom text, (all default views features) but I'm trying to find a way, while only using the CCK image and views to have the CCK image in the view link directly to the corresponding node.

Any help would be greatly appreciated!

subscribe - I'd like to know

ray_223 - March 31, 2008 - 22:19

subscribe - I'd like to know this as well!
I worked around it (I assume badly) by theming the full CCK node.

Ray Smith
http://RaymondSmith.com

I got it working

ghumpley - April 5, 2008 - 12:13

I had a custom template file for my view that was generated through the views theme wizard.

As an example, here is the field that contained the image from my cck image field:

<?php print $field_image_fid ?>

I replaced that code with this:

<?php print l($field_image_fid, "node/$node->nid", array(), NULL, NULL, FALSE, TRUE); ?>

And now it's working!

Obviously, replace $field_image_fid with your field.

 
 

Drupal is a registered trademark of Dries Buytaert.