Jump to:

7940 Posts in 1543 Topics by 946 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » Image gallery problem

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1 2
Go to End
Author Topic: 1530 Views
  • stevanovich
    Avatar
    Community Member
    60 Posts

    Image gallery problem Link to this post

    Hi UncleCheese

    I am now thoroughly confused. I have upload new site with ss 2.4 and have DOM and Image gallery. I have an image gallery page top level and all albums work fine. As soon as I go down a level and setup a image gallery page it throws up an error when I click on an album. Works Top level works, not sub level. Wacky any ideas.

    Steve

    "Trying to get property of non-object"

    GET /what-we-do-2/test-gallery/album/test1

    Line 194 in /www/sw1b/image_gallery/code/ImageGalleryPage.php

    Source

    185       if($url_segment = Director::urlParam('ID')) {
    186          $albums = DataObject::get($this->albumClass,"ImageGalleryPageID = {$this->ID} AND File.Name = '$url_segment'", "", "LEFT JOIN File ON File.ID = FolderID");
    187          return $albums ? $albums->First() : false;
    188       }
    189       return false;
    190    }
    191    
    192    public function AlbumTitle()
    193    {
    194       return $this->CurrentAlbum()->AlbumName;
    195    }
    196

  • UncleCheese
    Avatar
    4085 Posts

    Re: Image gallery problem Link to this post

    Looks like an old version of ImageGallery to me. When was the last time you updated? That code isn't 2.4 compatible.

  • stevanovich
    Avatar
    Community Member
    60 Posts

    Re: Image gallery problem Link to this post

    Seems like a possibility as I have been working on existing sites with 2.3 and new sites with 2.4 so could be mixed up somewhere. Can I just copy all files/folders except the templates or have the template got new elements.

  • UncleCheese
    Avatar
    4085 Posts

    Re: Image gallery problem Link to this post

    You made modifications to the core templates?!

  • stevanovich
    Avatar
    Community Member
    60 Posts

    Re: Image gallery problem Link to this post

    yes only the theme templates to work with my layout??

  • UncleCheese
    Avatar
    4085 Posts

    Re: Image gallery problem Link to this post

    You should never have to modify any of the templates, code, or CSS in a module. Silverstripe gives you a full-featured theming framework.. use it!!

    Any template you place in your theme dir will override its counterpart in a module. Same with CSS.

    If you add /your_theme/templates/Layout/ImageGallery_album.ss to your site, SSViewer will look there first before falling back on the default templates for ImageGallery. Likewise, /your_theme/css/ImageGallery.css will override the core CSS.

    Modules should remain insular so that you don't have to pull your hair out when an upgrade comes out!

  • stevanovich
    Avatar
    Community Member
    60 Posts

    Re: Image gallery problem Link to this post

    So if I wanted the sidebar menu from the templates which is located in the blackcandy layout folder to appear in the gallery page where would this be amended.

  • UncleCheese
    Avatar
    4085 Posts

    Re: Image gallery problem Link to this post

    Wherever you want it to go. Once a template is in your theme dir you can do whatever you want. Just don't alter the one in the image_gallery directory.

    1530 Views
Page: 1 2
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.