Jump to:

10929 Posts in 2613 Topics by 1809 members

All other Modules

SilverStripe Forums » All other Modules » implementing an image gallery in a different type of page

Discuss all other Modules here.

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

Page: 1
Go to End
Author Topic: 1240 Views
  • mattconfusion
    Avatar
    Community Member
    48 Posts

    implementing an image gallery in a different type of page Link to this post

    I need to implement an image gallery like the one created with the Image Gallery module. The matter is that I have to do it in page type which has been already extended from another page type. For example: Mypage is extending ACertainModulePage, so i cannot make it as an extension of Image Gallery page type.
    Any suggestions, hacks, tricks, whatever?

  • Bambii7
    Avatar
    Community Member
    254 Posts

    Re: implementing an image gallery in a different type of page Link to this post

    It's a bit of a hack but you could make your Page thats extending AcertainModulePage have a relationship with a gallery page.

    class MyPage extends ACertainModulePage {

    static $has_one = array ("Gallery"=>"GalleryPage");

    }

    I find the best solution to image galleries UncleCheese's DataObjectManager module, thats just me though. You could try looking at the code within GalleryPage and merging it into your MyPage class.

  • mattconfusion
    Avatar
    Community Member
    48 Posts

    Re: implementing an image gallery in a different type of page Link to this post

    thanks bambi I indeed used DataObjectManager now and it does what I wanted without the gallery module thing. Thank you very much

  • Mark1
    Avatar
    Community Member
    6 Posts

    Re: implementing an image gallery in a different type of page Link to this post

    Can anyone tell, pls, how to get ImageGallery (from UncleCheese) in other page types ?
    I've spent days trying to move/copy the code, but no success(( Just don't get, what should extend what...

  • Bambii7
    Avatar
    Community Member
    254 Posts

    Re: implementing an image gallery in a different type of page Link to this post

    Sorry a little hazy on the whole image gallery thing, been looking at Flex and other languages for the past few months (I miss SS).

    Do you have any code examples of what you're trying to do Mark1? I don't actually use the image gallery component.
    If you want a custom variation of the UncleCheese's gallery page the best way is to extend it. ImageGallery will most likely extend Page, Page is the main class in the mysite folder (you probably know this but I'm just saying it again for clarity). So any values or functions you assign to Page, ImageGallery will pick up or inherit. This is good for global things because all pages will pick up on these additions.

    For a custom ImageGellery that doesn't affect other pages, you can extend ImageGallery. Make a new PHP file in mysite/code called MyImageGallery with the following PHP

    <?php

    class MyImageGallery extends ImageGallery {

    }


    I hope this helps? just ask if it's still confusing, I'll try not to wait a year between replies.
    P.S. SS is tricky to start developing for in comparison to Joomla but you should find it much more powerful in the long run.

  • Mark1
    Avatar
    Community Member
    6 Posts

    Re: implementing an image gallery in a different type of page Link to this post

    Doh, that's me who is sorry)) Yeah, many things are confusing, still, and are going to be..
    Do you have any code examples of what you're trying to do Mark1? yes, sure, but IMO they are too large to stick in here.
    Learning SS, I tend to think that any FileName.php inside \mysite\code (or inside any module) must contain 2 things - model and controller. Model is smth like 'class ImageGalleryPage extends Page {}', Controller is smth like 'class ImageGalleryPage_Controller extends Page_Controller'...I understand that only after creating proper DB fields and relations, the Admin panel changes, and front shows correct things. And I think, the file must contain only one model, and the corresponding controller. I wonder if I'm right....

    What I've been trying to do is to move the code that is inside {} of model and controller of the ImageGalleryPage.php located at \image_gallery\code\ to the of the Page.php located at \mysite\code ...After that I need to amend the Page.ss + make \dev\build, but that's not a problem. No luck so far with moving the code ! =(

    Bad thing is, I'm not 100% sure what is the correct synthax. Maybe moving is not enough..

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