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.

All other Modules

Discuss all other Modules here.

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

implementing an image gallery in a different type of page


6 Posts   1261 Views


5 July 2010 at 8:21pm Community Member, 48 Posts

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?


5 July 2010 at 8:46pm Community Member, 254 Posts

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.


6 July 2010 at 2:02am Community Member, 48 Posts

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


8 July 2011 at 11:38pm (Last edited: 11 July 2011 8:18pm), Community Member, 6 Posts

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...


13 July 2011 at 3:21am (Last edited: 13 July 2011 3:29am), Community Member, 254 Posts

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


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.


13 July 2011 at 9:58pm (Last edited: 13 July 2011 10:05pm), Community Member, 6 Posts

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 + 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..