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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Image gallery problem


Go to End


10 Posts   2374 Views

Avatar
stevanovich

Community Member, 63 Posts

16 June 2010 at 5:54am

Edited: 16/06/2010 5:55am

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

Avatar
UncleCheese

Forum Moderator, 4102 Posts

16 June 2010 at 6:23am

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

Avatar
stevanovich

Community Member, 63 Posts

16 June 2010 at 6:34am

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.

Avatar
UncleCheese

Forum Moderator, 4102 Posts

16 June 2010 at 7:19am

You made modifications to the core templates?!

Avatar
stevanovich

Community Member, 63 Posts

16 June 2010 at 7:21am

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

Avatar
UncleCheese

Forum Moderator, 4102 Posts

16 June 2010 at 7:26am

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!

Avatar
stevanovich

Community Member, 63 Posts

16 June 2010 at 7:37am

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.

Avatar
UncleCheese

Forum Moderator, 4102 Posts

16 June 2010 at 8:05am

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