Last updated June 27, 2008. Created by Rick Hood on June 27, 2008.
Log in to edit this page.
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 clikcable 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;
}
Comments
Where is function _nodecarousel_find_image_in_string() ?
Where is the function _nodecarousel_find_image_in_string() ?
John Jesus
http://www.worldwideclarity.com
theme_nodecarousel_node
This
$content .= _nodecarousel_find_image_in_string($view);is found within the functiontheme_nodecarousel_node($node, $name='')around line 1600 in nodecarousel.module.Is it completed solution?
When I pasted that code into template.php,I got the following:
Fatal error: Call to undefined function _nodecarousel_find_image_in_string()
Nodecarousel is displaying all nodes at once in IE7 but in FF
Nodecarousel is displaying all nodes at once in IE7 but in FF it works fine by showing 5 nodes at once.Can this be fixed in IE7 too?
I copied your function to my
I copied your function to my them, but it didnt worked, It showed node title only. Can you help me out?