Nodecarousel

Last modified: June 27, 2008 - 15:41

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;
}

Where is function _nodecarousel_find_image_in_string() ?

jjesus - December 5, 2008 - 12:58

Where is the function _nodecarousel_find_image_in_string() ?

theme_nodecarousel_node

Rick Hood - December 7, 2008 - 15:13

This $content .= _nodecarousel_find_image_in_string($view); is found within the function theme_nodecarousel_node($node, $name='') around line 1600 in nodecarousel.module.

Is it completed solution?

volocuga - March 21, 2009 - 16:30

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

zohera - June 18, 2009 - 07:39

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?

 
 

Drupal is a registered trademark of Dries Buytaert.