HI
i got the nodecarousel setup and it circles my node titles as advertised. As many others i'd like to have it show cck filefield image instead of the title. The cck filefield image is resized by imagecache. I've tried all the codesnippets for simalar image carousel requests but it all ends up just showing me the clickable title. My cck filefield image is stored in field_cover, my imagecache preset is called "cover".
I changed a snippet i found and tried adding the following to template.php of my theme internet_studio:
function internet_studio_nodecarousel_node($node, $name='') {
$content = '<div class="node-carousel-item">';
$node = node_build_content($node, TRUE, FALSE);
$content .= '<div class="hidden nid">'. $node->nid .'</div>';
$content .= '<div class="carousel-image">'. theme('imagecache', 'cover', $node->field_cover[0]['filepath']) .'</div>';
$content .= ''. l($node->field_intro[0]['value'], 'node/'. $node->nid) .'';
$content .= '</div>';
return $content;
}
but to no avail. I tried pasting the code from the handbook page (without changing anything but my theme name after the funtion) : http://drupal.org/node/275747 but that didnt help either. I have no idea weither it has to do with filefield image, with putting stuff in the wrong place or just not knowing enough php so my modifications to the snippets just arent correct. Thats why i tried adding as much info about imagecache presets, themename etc.
I hope someone can point me in the right direction because this is the final thing i need to get fixed before i can put my site live :)
Kind regards
Yoda99
Comments
Comment #1
gthing commentedI can't get this snippet to work either. The only thing I am changing is the spot where you have "cover" to the imagefield I have defined. Should I also be changing "filepath?' If so is there an example of what it should look like?
Comment #2
Steve Dondley commentedDid you clear your cache?
Comment #3
gthing commentedI got it working by updating to the dev version of nodecarousel. Thanks, Steve.
Comment #4
georgedamonkey commentedI'm also trying to get this working, and have the latest dev version of the module. Here's what I have for my code:
I'm using the 'deco' theme, and my imagecache is called 'featured'. What ends up showing is broken images with this as the path for them: http://beta.menashalibrary.org/sites/beta.menashalibrary.org/files/image... so, it's not pulling the image from the nodes to display in that box.
Previously, I had this code which did work fine:
But, that pulled the image from the image module. I'd much rather use the imagecache module instead.
I'd really appreciate any help you can provide.
Comment #5
bgilday commentedYour first code snippet worked ok for me, with the exception that the image did not link to the full node. I made a slight tweak to the code to fix the image link issue and it works just great. I'm using nodecarousel version 1.0, my theme name is cwl, my imagecache preset name is headline and my image field name is field_image_attachment. Here's the template.php code snippet:
I hope this helps.
Comment #6
georgedamonkey commentedI tried your snippet, replacing with my information, and when I view the page I get this error message:
Fatal error: Unsupported operand types in /var/clients/client0/web2/web/includes/common.inc on line 1445
Comment #7
georgedamonkey commentedNevermind. Spent a bit more time with it and I was able to tweak the code to get it to work:
But, that doesn't link the image to the node. I 'think' I need to add in this: 'node/'. $node->nid, array('html' => TRUE)) .
But, any combination I try I end up with an error and it doesn't load. What am I missing?
Thank you so much for your help.
Comment #8
bgilday commentedTry this - I added one line of code for the image link...
Comment #9
georgedamonkey commentedI replaced my code with yours, and now I get this error when loading the page:
Fatal error: Unsupported operand types in /var/clients/client0/web2/web/includes/common.inc on line 1445
Comment #10
bgilday commentedPerhaps it is a D5 versus D6 issue - maybe changes within common.imc? I am running in Drupal Version 5.10. I did notice this common.inc error similar to yours.
Comment #11
georgedamonkey commentedAh, yes. I'm running Drupal 6.4.
Comment #12
jessicakoh commentedI use this method.
For imagecache, got to your content type, edit content type, go to "Display field", change display field as "imagecache as link" in your teaser. You should be able to get a link.
Does this work for you?
Comment #13
jessicakoh commentedhttp://drupal.org/node/228291
Try the snippet for template.php
Comment #14
georgedamonkey commentedThat didn't work for me, unfortunately. When I looked in there, I noticed it was all ready set to do that. But, alas, it doesn't work at all.
Comment #15
georgedamonkey commentedI tried that snippet as well, but unfortunately that didn't cause the image to be a link either.
Comment #16
jessicakoh commentedThis is a snippet from the template.php of a theme that has similar function. Does the code make any sense to you?
I am still a newbie. Hope this help.
Comment #17
ultimateboy commentedDuplicate. http://drupal.org/node/318201