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


Reply


6 Posts   1283 Views

Avatar
mattconfusion

Community Member, 48 Posts

5 July 2010 at 8:21pm

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?

Avatar
Bambii7

Community Member, 254 Posts

5 July 2010 at 8:46pm

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.

Avatar
mattconfusion

Community Member, 48 Posts

6 July 2010 at 2:02am

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

Avatar
Mark1

Community Member, 6 Posts

8 July 2011 at 11:38pm

Edited: 11/07/2011 8:18pm

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

Avatar
Bambii7

Community Member, 254 Posts

13 July 2011 at 3:21am

Edited: 13/07/2011 3:29am

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.

Avatar
Mark1

Community Member, 6 Posts

13 July 2011 at 9:58pm

Edited: 13/07/2011 10:05pm

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