Nodecarousel
Last updated on
30 April 2025
I just used Nodecarousel (http://drupal.org/project/nodecarousel) recently and wanted to post a "How To" about a detail of it that others will probably want to do.
In my use case, I wanted only images to show in the nodecarousel, not title, body, etc. And, I wanted the image to take you to the full node when clicked.
To do that I copied the function theme_nodecarousel_node into my template.php file and altered it to look like the following (in my case was using the Zen theme):
function zen_nodecarousel_node($node, $name='') {
$content = '<div class="node-carousel-item">';
/*$content .= '<div class="node-carousel-title node-carousel-label">'. l($node->title, 'node/'. $node->nid) .'</div>';*/
$content .= '<div class="readmore">'. l('Learn more', 'node/'. $node->nid) .'</div>';
$content .= '<div class="hidden node-carousel-label">'. l($node->title, 'node/'. $node->nid) .'</div>';
/* $content .= '<div class="node-carousel-body">'. $node->body .'</div>';*/
$view = node_view($node, TRUE, FALSE, FALSE);
/* NOTE I added the two lines below, and commented out the third line to make the image in the carousel clickable to the full node
This helped: http://drupal.org/node/105249*/
$carousel_image = _nodecarousel_find_image_in_string($view);
$content .= l($carousel_image, 'node/'. $node->nid, NULL , NULL, NULL, FALSE, TRUE);
/*$content .= _nodecarousel_find_image_in_string($view);*/
$content .= '<div class="hidden nid">'. $node->nid .'</div>';
$node_words = explode(' ', $node->title);
$content .= '<div class="hidden node-carousel-index">'. $node_words[0] .'</div>';
$content .= '</div>';
return $content;
}
Help improve this page
Page status: Not set
You can:
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion