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.

All other Modules /

Discuss all other Modules here.

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

Gallery: show image details


Go to End


29 Posts   7849 Views

Avatar
pinkp

Community Member, 182 Posts

13 November 2009 at 10:07am

Hello again,

I've just installed this mod again for another site and added the MyImageGalleryPage subclass which comes up in the CMS,
But
The actual albums and their content are just blank! the page is there is just has nothing on it, only what is typed in the content area.
I can't figure out what I forgot to add... The standard ImageGalleryPage works just fine.
Also adding "SortableDataObject::add_sortable_class("MyImageGalleryItem");" to the config is causing a PHP error, perhaps these are related?
Help appreciated im stuck!!

Many thanks!

Avatar
pinkp

Community Member, 182 Posts

13 November 2009 at 11:20am

Strangely enough after changing the page type to ImageGalleryPage, it now works... including all the title extensions etc. does that seem strange?

Avatar
Rishi

Community Member, 97 Posts

28 January 2010 at 3:14am

I am tring to do the same thing My code is

MyImageGalleryItem.php

class MyImageGalleryItem extends ImageGalleryItem
{
static $db = array (
'PaintingName' => 'Varchar(100)',
'PaintingDimensions' => 'Varchar(50)',
'Media' => 'Varchar(50)'

);

public function getCMSFields_forPopup()
{
$f = parent::getCMSFields_forPopup();
$f->push(new TextField('PaintingName','Name of painting'));
$f->push(new TextField('PaintingDimensions','Dimensions of painting'));
$f->push(new TextField('Media','Media'));
return $f;
}
}
?>

MyImageGalleryPage.php

<?php
class MyImageGalleryPage extends ImageGalleryPage {
protected $itemClass = "MyImageGalleryItem";
}

//class MyImageGalleryPage_Controller extends ImageGallery_Controller {
class MyImageGalleryPage_Controller extends ImageGalleryPage_Controller {

}
?>

the upper two files are inside code under /mysite/code

and /blackcandy/templates/Includes/GalleryUI_layout.ss
<% if GalleryItems %>
<ul class="gallery-layout" id="gallery-list">
<% if GalleryItems.NotFirstPage %>
<% control PreviousGalleryItems %>
<li style="display:none;">$GalleryItem</li>
<% end_control %>
<% end_if %>
<% control GalleryItems %>
<li style="height:{$ThumbnailHeight}px;width:{$ThumbnailWidth}px;">
$GalleryItem
<h3>$PaintingName</h3>

</li>
<% end_control %>
<% if GalleryItems.NotLastPage %>
<% control NextGalleryItems %>
<li style="display:none;">$GalleryItem</li>
<% end_control %>
<% end_if %>
</ul>
<% end_if %>

and i have done dev/build

though the page is there and its creating a new template but when I am opening the page there is no image even though i have added a new album and image in this page.I need to print a image name below the image
there is no error also
Please help me.
thank you in advance

Avatar
pinkp

Community Member, 182 Posts

28 January 2010 at 4:09am

I had this problem sometimes... UncleCheese may disagree with me but if you've set your page type to "MyImageGallery" in the CMS (which I'm sure you have) make sure you have a template called MyImageGalleryPage.ss and MyImageGalleryPage_album.ss in the folder:

image_gallery > templates > Layout

I simply duplicated the original template files and changed the file names. However I did not need to do this for one of my sites for some reason.. and you may be able to put them in your theme template folder not sure haven't checked, UC would know better than I.

See how that goes.

Avatar
servalman

Community Member, 211 Posts

5 March 2011 at 12:47am

Hello

Following the instruction I have managed to make things work as far as having the new picture details ('PaintingName' etc) showing under the thumbnail of the image.

Now (i'm using lightbox) I'm trying to have them show in the popup (big image) .

Is there a template for that or is it some coding ?

Thanks

Go to Top