Posted by KyleBalderson on March 1, 2010 at 8:44pm
2 followers
| Project: | Jquery Slideshow |
| Version: | 6.x-1.2 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | patch (to be ported) |
Issue Summary
When previewing a node before insert, i got an error in foreach on line 69.
I changed:
$node = node_load($element['#item']['nid']);to:
$node = isset($element['#item']['nid']) ? node_load($element['#item']['nid']) : $element['#node'];If you have a maximum number of images, and only use a few of them, all slots were displaying, the remainder with broken images.
I changed:
$output .= theme('imagecache', $preset, $image['filepath'], $image['data']['alt'], $image['data']['title']);to:
$output .= is_numeric($image['fid']) ? theme('imagecache', $preset, $image['filepath'], $image['data']['alt'], $image['data']['title']) : '';
Comments
#1
Dont know if patch got uploaded. Also, sorry if this is a duplicate of some issues, just wanted to help out, but am myself on a tight timeline.
#2
I had the same issue. I was experiencing this when I had a node that did not have any images associated with it. This is something that is allowed by my particular use case.
The error message I received was:
warning: Invalid argument supplied for foreach() in {PATH}/sites/all/modules/jquery_slideshow/jquery_slideshow.module on line 69.
The reason for this is that the node array is empty. So i just added a little if statement to check to make sure there was something in there before the foreach. The diff is attached.
Thanks for your work and creating this module!