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.

DataObjectManager Module

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Image gallery problem

Go to End

10 Posts   1557 Views


16 June 2010 at 5:54am (Last edited: 16 June 2010 5:55am), Community Member, 60 Posts

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.


"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


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    }
192    public function AlbumTitle()
193    {
194       return $this->CurrentAlbum()->AlbumName;
195    }


16 June 2010 at 6:23am 4085 Posts

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


16 June 2010 at 6:34am Community Member, 60 Posts

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.


16 June 2010 at 7:19am 4085 Posts

You made modifications to the core templates?!


16 June 2010 at 7:21am Community Member, 60 Posts

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


16 June 2010 at 7:26am 4085 Posts

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/ 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!


16 June 2010 at 7:37am Community Member, 60 Posts

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.


16 June 2010 at 8:05am 4085 Posts

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.

Go to Top