How to have image link to node (ver. 6)
georgedamonkey - October 7, 2008 - 18:47
| Project: | Nodecarousel |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | by design |
Jump to:
Description
Hello,
I'm wondering how to link the image in a carousel to the node it's from with the module for Drupal 6? I've seen examples for 5 but not 6. I'm pulling the image from an imagecache. Here's what I've got for code so far:
function deco_nodecarousel_node($node, $name='') {
$content = '<div class="node-carousel-item">';
$image_node = node_load($node->iid);
$content .= '<div class="carousel-image">'. theme('imagecache', 'featured', $node->field_image[0]['filepath']) .'</div>';
$content .= '<div class="hidden nid">'. $node->nid .'</div>';
$content .= '<div class="teaser"><div class="featured-title">'.l($node->title, 'node/' .$node->nid) .'</div><div class="node-carousel-index">'. $node->teaser .' <div id="read-more"> '.l('[Read More]', 'node/'. $node->nid).' </div></div></div>';
$content .= '<div class="corners" id="c_left_top"></div>';
$content .= '<div class="corners" id="c_right_top" style="left: 636px;"></div>';
$content .= '<div class="corners" id="c_left_bottom" style="top: 226px;"></div>';
$content .= '<div class="corners" id="c_right_bottom" style="top: 226px; left: 636px;"></div>';
$content .= '</div>';
return $content;
}
#1
You should be able to do this by simply using l().
<?php$content .= '<div class="carousel-image">'. l(theme('imagecache', 'featured', $node->field_image[0]['filepath']),'node/'.$node->nid) .'</div>';
?>
#2