Jump to:

794 Posts in 408 Topics by 304 members

Widgets

SilverStripe Forums » Widgets » Modifying Gallery Widget : Latest Galleries

Discuss SilverStripe Widgets.

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

Page: 1
Go to End
Author Topic: 316 Views
  • Fraser
    Avatar
    Community Member
    46 Posts

    Modifying Gallery Widget : Latest Galleries Link to this post

    Another query about some modifications to the gallery widget..

    I need to be able to pull out an image (doesn't matter which) from one of the listed galleries.

    function Galleries() {
           $nrtoshow = (0<$this->NumberToShow) ? "0,".$this->NumberToShow : "";
       $galleries = DataObject::get(
          "Page",
          "SiteTree_Live.ClassName = 'GalleryPage' AND ShowInMenus = 1",
          "LastEdited DESC",
          "",
          "$nrtoshow"
       );
       
          return $galleries;
       }

    I tried adding a join:

    LEFT JOIN GalleryPage ON SiteTree_Live.ID = GalleryPage.ID LEFT JOIN File ON (GalleryPage.FolderID = File.ParentID AND File.ClassName='Image')

    but because it is a page object am unable to output an Image object. Is there a way I can do this?

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