Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Widgets /

Discuss SilverStripe Widgets.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Gallery widget 0.1 vs SilverStripe 2.3.1


Reply


5 Posts   1918 Views

Avatar
Tempesta

Community Member, 8 Posts

16 April 2009 at 12:37am

Hello. I just installed the gallery widget - http://silverstripe.org/Gallery-Widgets/ - successfully. I added a latest gallery widget which displays the latest galleries successfully, but when I tried to add a latest pictures widget I got an error when loading the page:

Website Error
There has been an error

The website server has not been able to respond to your request.

I suspect this has to do with the latest version of SS doesn't work with the gallery widget? Is there a quick fix for this?

Thanks :)

Avatar
Tempesta

Community Member, 8 Posts

17 April 2009 at 6:33am

Ok, I'm at work and I'm keeping this on hold, can anyone confirm that this is a known bug? And that Silverstripe 2.3.1 does not work properly with the gallery_widget 0.1 (the "latest pictures" that is) if so, I have to look into making one myself, and I don't want to waste time if nobody else has this problem (thus it being something I've done wrong) or if there is a simple workaround.

Thanks Tempesta =)

Avatar
gakenny

Community Member, 153 Posts

17 April 2009 at 12:35pm

Hi Tempesta,

There is an issue with this module and SS 2.3.1 on Linux servers. I believe that this is related to case in the code. Can you post the error message you get and I will look up the solution in the Bug Tracker.

Cheers,

Gary

Avatar
Tempesta

Community Member, 8 Posts

18 April 2009 at 1:10am

Thanks for your reply :)

her is the error:

Line 394 in /home/markedsf/public_html/sapphire/core/model/MySQLDatabase.php
Source

385    }
386    
387    function databaseError($msg, $errorLevel = E_USER_ERROR) {
388       // try to extract and format query
389       if(preg_match('/Couldn\'t run query: ([^\|]*)\|\s*(.*)/', $msg, $matches)) {
390          $formatter = new SQLFormatter();
391          $msg = "Couldn't run query: \n" . $formatter->formatPlain($matches[1]) . "\n\n" . $matches[2];
392       }
393       
394       user_error($msg, $errorLevel);
395    }
396 }
397
398 /**
399 * A result-set from a MySQL database.
400 * @package sapphire

Trace

* Couldn't run query: SELECT f.`ID`, f.`Filename`, f.`Name`, f.`Title`, s.`URLSegment` FROM `gallerypage_live` g LEFT JOIN `sitetree_live` s ON g.`ID` = s.`ID` LEFT JOIN `file` f ON f.`ParentID` = g.`FolderID` WHERE f.`ClassName` = 'Image' ORDER BY f.`Created` DESC LIMIT 0,1; Table 'markedsf_mf.gallerypage_live' doesn't exist
Line 394 of MySQLDatabase.php
* MySQLDatabase->databaseError(Couldn't run query: SELECT f.`ID`, f.`Filename`, f.`Name`, f.`Title`, s.`URLSegment` FROM `gallerypage_live` g LEFT JOIN `sitetree_live` s ON g.`ID` = s.`ID` LEFT JOIN `file` f ON f.`ParentID` = g.`FolderID` WHERE f.`ClassName` = 'Image' ORDER BY f.`Created` DESC LIMIT 0,1; | Table 'markedsf_mf.gallerypage_live' doesn't exist,256)
Line 102 of MySQLDatabase.php
* MySQLDatabase->query(SELECT f.`ID`, f.`Filename`, f.`Name`, f.`Title`, s.`URLSegment` FROM `gallerypage_live` g LEFT JOIN `sitetree_live` s ON g.`ID` = s.`ID` LEFT JOIN `file` f ON f.`ParentID` = g.`FolderID` WHERE f.`ClassName` = 'Image' ORDER BY f.`Created` DESC LIMIT 0,1;,256)
Line 104 of DB.php
* DB::query(SELECT f.`ID`, f.`Filename`, f.`Name`, f.`Title`, s.`URLSegment` FROM `gallerypage_live` g LEFT JOIN `sitetree_live` s ON g.`ID` = s.`ID` LEFT JOIN `file` f ON f.`ParentID` = g.`FolderID` WHERE f.`ClassName` = 'Image' ORDER BY f.`Created` DESC LIMIT 0,1;)
Line 46 of LatestPicturesWidget.php
* LatestPicturesWidget->Pictures()
* call_user_func_array(Array,Array)
Line 319 of ViewableData.php
* ViewableData->obj(Pictures)
Line 6 of .cache.home.markedsf.public_html.widgets_gallery.LatestPicturesWidget.ss
* include(/home/markedsf/public_html/silverstripe-cache/.cache.home.markedsf.public_html.widgets_gallery.LatestPicturesWidget.ss)
Line 350 of SSViewer.php
* SSViewer->process(LatestPicturesWidget)
Line 774 of ViewableData.php
* ViewableData->renderWith(LatestPicturesWidget)
Line 37 of Widget.php
* Widget->Content()
* call_user_func_array(Array,Array)
Line 409 of ViewableData.php
* ViewableData->XML_val(Content,,1)
Line 11 of .cache.home.markedsf.public_html.themes.mf_blog.templates.WidgetHolder.ss
* include(/home/markedsf/public_html/silverstripe-cache/.cache.home.markedsf.public_html.themes.mf_blog.templates.WidgetHolder.ss)
Line 350 of SSViewer.php
* SSViewer->process(LatestPicturesWidget)
Line 774 of ViewableData.php
* ViewableData->renderWith(WidgetHolder)
Line 33 of Widget.php
* Widget->WidgetHolder()
* call_user_func_array(Array,Array)
Line 409 of ViewableData.php
* ViewableData->XML_val(WidgetHolder,,1)
Line 10 of .cache.home.markedsf.public_html.sapphire.templates.WidgetArea.ss
* include(/home/markedsf/public_html/silverstripe-cache/.cache.home.markedsf.public_html.sapphire.templates.WidgetArea.ss)
Line 350 of SSViewer.php
* SSViewer->process(WidgetArea)
Line 774 of ViewableData.php
* ViewableData->renderWith(WidgetArea)
Line 22 of WidgetArea.php
* WidgetArea->forTemplate()
Line 425 of ViewableData.php
* ViewableData->XML_val(SideBar,,1)
Line 8 of .cache.home.markedsf.public_html.blog.templates.Layout.BlogHolder.ss
* include(/home/markedsf/public_html/silverstripe-cache/.cache.home.markedsf.public_html.blog.templates.Layout.BlogHolder.ss)
Line 350 of SSViewer.php
* SSViewer->process(BlogHolder_Controller)
Line 342 of SSViewer.php
* SSViewer->process(BlogHolder_Controller)
Line 175 of Controller.php
* Controller->handleAction(HTTPRequest)
Line 107 of RequestHandler.php
* RequestHandler->handleRequest(HTTPRequest)
Line 122 of Controller.php
* Controller->handleRequest(HTTPRequest)
Line 19 of ModelAsController.php
* ModelAsController->handleRequest(HTTPRequest)
Line 27 of RootURLController.php
* RootURLController->handleRequest(HTTPRequest)
Line 262 of Director.php
* Director::handleRequest(HTTPRequest,Session)
Line 106 of Director.php
* Director::direct()
Line 115 of main.php

Avatar
gakenny

Community Member, 153 Posts

28 April 2009 at 8:37pm

Hello,

Sorry for the slow reply - I forgot to subscribe to this thread and did't see your post.

I can see that the error does *appear* to be the issue I thought. Unfortunately, I cannot connect to open.silverstripe.org to dig out the patch. However, try modifying line 46 of the LatestPicturesWidget.php and change to the following:
    $pictures = DB::query("SELECT f.`ID`, f.`Filename`, f.`Name`, f.`Title`, s.`URLSegment` FROM `GalleryPage_Live` g LEFT JOIN `SiteTree_Live` s ON g.`ID` = s.`ID` LEFT JOIN `File` f ON f.`ParentID` = g.`FolderID` WHERE f.`ClassName` = 'Image' ORDER BY f.`Created` DESC LIMIT 0,$nrtoshow;");

This will ensure that the tablenames are in the correct case.

Let me know how you get along.

Cheers,

Gary