7921 Posts in 1359 Topics by 933 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » Issue with ImageGallery $RecentImagesGallery
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 1123 Views |
-
Issue with ImageGallery $RecentImagesGallery

23 September 2009 at 6:16pm
I have been trying to figure this one out but to no avail. I want to pass two parameters in the RecentImagesGallery function. Example on a template page I would call $RecentImagesGallery(12,team-gallery).
I continue to get SQL syntax errors in DEV mode. I am running SS2.3.3, and have tried altering things in the class ImageGallerySiteTree to track the issue. No luck.
Here is the error output from DEV:
#########################
[User Error] Couldn't run query: SELECT `ImageGalleryItem`.*, `ImageGalleryItem`.ID, if(`ImageGalleryItem`.ClassName,`ImageGalleryItem`.ClassName,'ImageGalleryItem') AS RecordClassName FROM `ImageGalleryItem` WHERE (ImageGalleryPageID = ) ORDER BY Created DESC LIMIT 12 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') ORDER BY Created DESC LIMIT 12' at line 1
#########################Any assitiance would be greatly appreciated.
-
Re: Issue with ImageGallery $RecentImagesGallery

24 September 2009 at 7:28am
In ImageGallerySiteTree.php, look at this function:
function RecentImages($count = 5, $url_segment = null)
{
$gallery = $this->getGalleryFor($url_segment);
if($gallery) {
$items = DataObject::get("ImageGalleryItem","ImageGalleryPageID = {$gallery->ID}","Created DESC",null,$count);You'll see that $gallery is obviously coming back as an object because you're not getting a non-object error, but for whatever reason it doesn't have an ID. Can you see what the getGalleryFor() is returning? Something's screwy.
-
Re: Issue with ImageGallery $RecentImagesGallery

26 June 2010 at 1:13am
Hi guys!
Did you sort out this problem? I get a similar error... The function works when I just call $RecentImagesGallery(5), but when I insert a URLSegment I get following mySql error:
[User Error] Couldn't run query: SELECT "ImageGalleryItem"."ClassName", "ImageGalleryItem"."Created", "ImageGalleryItem"."LastEdited", "ImageGalleryItem"."Caption", "ImageGalleryItem"."SortOrder", "ImageGalleryItem"."ImageGalleryPageID", "ImageGalleryItem"."AlbumID", "ImageGalleryItem"."ImageID", "ImageGalleryItem"."ID", CASE WHEN "ImageGalleryItem"."ClassName" IS NOT NULL THEN "ImageGalleryItem"."ClassName" ELSE 'ImageGalleryItem' END AS "RecordClassName" FROM "ImageGalleryItem" WHERE (ImageGalleryPageID = ) ORDER BY Created DESC LIMIT 5 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') ORDER BY Created DESC LIMIT 5' at line 1
-
Re: Issue with ImageGallery $RecentImagesGallery

26 June 2010 at 1:43am Last edited: 26 June 2010 1:44am
I think I see the problem. Line 8 of ImageGallerySiteTree.php uses get() instead of get_one();
return ($url_segment === null) ? DataObject::get_one("ImageGalleryPage") : DataObject::get_one("ImageGalleryPage","URLSegment='$url_segment'");
That's fixed in the latest rev.
-
Re: Issue with ImageGallery $RecentImagesGallery

28 June 2010 at 11:10pm
Thank you very much UncleCheese!
That did the trick!And thank you for the great modules you have developed!
| 1123 Views | ||
|
Page:
1
|
Go to Top |


