How to link image in the slide to a node?

Your Ad Here

To link the image in the slide to the node you can use the l() function like below:

l($text, $path, $options = array())

if ($vars['imgcache_slide'] <> '<none>' && module_exists('imagecache') &&  is_array(imagecache_presets())){
  $slider_items[$key1]['slide_image'] = 
  l(theme('imagecache', 
          $vars['imgcache_slide'], 
          $filepath,
          check_plain($result->node_title)),                  
    'node/' . $result->nid,
    array('html' => TRUE,) // needed, Whether the title is HTML, or just plain-text. TRUE for HTML
  );
}
else {          
  $slider_items[$key1]['slide_image'] = 
  l('<img src="' . base_path() . $filepath . '" alt="' . check_plain($result->node_title . '"/>'),                  
    'node/' . $result->nid,
    array('html' => TRUE,) // needed, Whether the title is HTML, or just plain-text. TRUE for HTML
  );
}          

Comments

Thanks for this information

Thanks for this information and this fabulous module.

It would be helpful if the preprocess functions included a version of the template.php snippet with this inserted in the right place, for those who don't want to use the Read More button to link to the node. Any chance of that?thanks!

Re: Thanks for this information

I don't understand what your request is.
Can you be more clear, so I can help you better?

I would like to see this code

I would like to see this code inserted as well. Can we just put it anywhere in the preprocess functions? Does it go in both or only one? Do we need to change the theme files as well?

How do I link to a different node?

I've tried using this code in my template.php file in place of:

if (module_exists('imagecache') && is_array(imagecache_presets()) && $vars['imgcache_slide'] <> '<none>'){
              $slider_items[$key1]['slide_image'] = 
              theme('imagecache', 
                    $vars['imgcache_slide'], 
                    $filepath,
                    $result->node_title);
            }
            else {          
              $slider_items[$key1]['slide_image'] = 
                '<img src="' . base_path() . $filepath . 
                '" alt="' . $result->node_title . 
                '"/>';     
            }        

But it links to the node that displays the slide. I would like to link to a different page.

Re: How do I link to a different node?

Have a look at the How to: How to link Read more... button to another page instead of the node

This same URL field can be used for linking the slide to another page.

Hope this helps you further, please let me know.