Jump to:

23493 Posts in 19013 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » SSBits - Working with Banners || SS 2.4.2 Issue?

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1
Go to End
Author Topic: 870 Views
  • B-Side
    Avatar
    Community Member
    42 Posts

    SSBits - Working with Banners || SS 2.4.2 Issue? Link to this post

    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

  • swaiba
    Avatar
    Forum Moderator
    1792 Posts

    Re: SSBits - Working with Banners || SS 2.4.2 Issue? Link to this post

    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...

  • simon_w
    Avatar
    Forum Moderator
    473 Posts

    Re: SSBits - Working with Banners || SS 2.4.2 Issue? Link to this post

    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'.

  • B-Side
    Avatar
    Community Member
    42 Posts

    Re: SSBits - Working with Banners || SS 2.4.2 Issue? Link to this post

    Thanks - that is the case (ie the <> are there in my function, but not in the error message).

  • B-Side
    Avatar
    Community Member
    42 Posts

    Re: SSBits - Working with Banners || SS 2.4.2 Issue? Link to this post

    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?

    870 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.