Active
Project:
Content Templates (Contemplate)
Version:
5.x-2.02
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
28 Jun 2008 at 10:38 UTC
Updated:
24 Jun 2009 at 05:09 UTC
Hi,
How could I get the next code works?
I want to show a image linking to an url or an uploaded file, depending if I give an url or a link. I'm using three cck fields: imagecache, link and file.
I've put the following code in the node contemplate:
<?php if ($field_file): ?>
<a href="<?php print $node->field_file[0]['filepath'] ?>"><?php print $node->field_image[0]['view'] ?></a>
<?php endif; ?>
<?php if ($node->field_link): ?>
<a href="<?php print $node->field_link[0]['url'] ?>"><?php print $node->field_image[0]['view'] ?></a>
<?php endif; ?>Thanks in advance
Comments
Comment #1
miles28 commentedWell, I've got the same result with this simple code:
Comment #2
glennr commentedJust want to thank you for posting your solution, miles28. So simple yet it saved me hours . . .