Jump to:

10931 Posts in 2614 Topics by 1810 members

All other Modules

SilverStripe Forums » All other Modules » Gallery: show image details

Discuss all other Modules here.

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

Page: 1 2 3 4
Go to End
Author Topic: 4587 Views
  • pinkp
    Avatar
    Community Member
    168 Posts

    Re: Gallery: show image details Link to this post

    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!

  • pinkp
    Avatar
    Community Member
    168 Posts

    Re: Gallery: show image details Link to this post

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

  • Rishi
    Avatar
    Community Member
    97 Posts

    Re: Gallery: show image details Link to this post

    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

  • pinkp
    Avatar
    Community Member
    168 Posts

    Re: Gallery: show image details Link to this post

    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.

  • servalman
    Avatar
    Community Member
    211 Posts

    Re: Gallery: show image details Link to this post

    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

    4587 Views
Page: 1 2 3 4
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.