21487 Posts in 5783 Topics by 2621 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 676 Views |
-
SSBits - Working with Banners || SS 2.4.2 Issue?

3 November 2010 at 10:03am
I have used the code provided at the SSBits site for a number of my Silverstripe sites with no problems whatsoever:
http://www.ssbits.com/tutorials/2009/working-with-banners/However the first time I've attempted to use the OneRandomBanner function with 2.4.2 I'm getting the following error:
[User Error] Couldn't run query: SELECT "File"."ClassName", "File"."Created", "File"."LastEdited", "File"."Name", "File"."Title", "File"."Filename", "File"."Content", "File"."Sort", "File"."SortOrder", "File"."ParentID", "File"."OwnerID", "File"."ID", CASE WHEN "File"."ClassName" IS NOT NULL THEN "File"."ClassName" ELSE 'File' END AS "RecordClassName" FROM "File" WHERE ("File"."ClassName" IN ('Image','Image_Cached')) AND (ClassName "Folder" AND ParentID = SELECT ID FROM File WHERE ClassName = "Folder" AND Name = "Headers")) ORDER BY RAND() LIMIT 5 Unknown column 'Folder' in 'where clause'
This is a first - and the column 'Folder' is present.
Can anyone advise on this issue?
Many thanks,
Jayne -
Re: SSBits - Working with Banners || SS 2.4.2 Issue?

3 November 2010 at 10:35am Last edited: 3 November 2010 11:24am
clearly there is an '=' missing...
... AND (ClassName "Folder" AND ...
EDIT I take it back after looking at the article, that states it supports for 2.4, it's a '<>' that is missing... unless ss is failing to show that in the error message...
-
Re: SSBits - Working with Banners || SS 2.4.2 Issue?

3 November 2010 at 10:39am
The code was written for SS 2.3, which didn't use ANSI SQL. String literals need to be enclosed by single quotes rather than double quotes, as double quotes denotes a table or (as is the case here) column. You need to replace all occurrences of "Folder" with 'Folder'.
-
Re: SSBits - Working with Banners || SS 2.4.2 Issue?

3 November 2010 at 11:28am
Thanks - that is the case (ie the <> are there in my function, but not in the error message).
-
Re: SSBits - Working with Banners || SS 2.4.2 Issue?

3 November 2010 at 11:36am
Update - changing the quotes has removed the SQL error - thanks!
However nothing is returned to the template for the function call, despite the existence of the directory and images within it.
Suggestions?
| 676 Views | ||
|
Page:
1
|
Go to Top |

