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.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Gallery holder page to hold multiple galleries?


Go to End


6 Posts   3993 Views

Avatar
Salsy

Community Member, 3 Posts

18 May 2010 at 9:26am

Is there such thing as a gallery holder page? Our developer is away for 2 more days and I need an *easy* solution to create a holder page to nest multiple galleries under. This page would need to be very much like the image gallery page with a single image, title & desc. Is there a simple solution? I really should read the silverstipe book sitting on a desk nearby :)

Avatar
3dgoo

Community Member, 135 Posts

18 May 2010 at 12:40pm

Yes, the image gallery module works like this. You can create an Image Gallery Page, and that page can have multiple Albums inside it, and you can add images to any of these albums.

Example:
http://dataobjectmanager.carlinowebdesign.com/image-gallery-test/

Module:
http://silverstripe.org/imagegallery-module/

Avatar
Salsy

Community Member, 3 Posts

18 May 2010 at 1:18pm

Thanks amped up. Sorry, I dont think i explained myself that well. What I actually need is a holder page to hold multiple galleries which in turn hold mulitple albums. So say my top level page was My Photography Portfiolio, this holds multiple galleries ( image gallery pages), which in turn hold multiple Albums of images. Basically im pretty sure its not an automatic feature of the gallery. At this stage my image gallery pages are nested under a plain page type. This needs to read the Image Gallery Pages beneath it, and return a list of image galleries with image, title and description. I fear it may be complicated ...

Avatar
3dgoo

Community Member, 135 Posts

18 May 2010 at 2:04pm

Ah sorry Salsy, I misread your original Post.

Yes, you would need to create a new page type like 'GalleryHolderPage' and then program it to retrieve one photo and one description from each gallery, and then display it in your template.

It'll be simple once you've done this stuff before.

Avatar
UncleCheese

Forum Moderator, 4102 Posts

18 May 2010 at 2:19pm

See Tutorial #2 in the docs for extending basic page types. They explain this quite well using a "NewsHolder" example.

Avatar
Naren

Community Member, 21 Posts

22 November 2013 at 1:39am

Hi all,

I want to create multiple images galleries on a single page like

Gallery 1.

Gallery 2.

Gallery 3.

I Have created a gallery page but do not know to show multiple galleries in a single page

My GalleryPage.php is :

<?php

class GalleryPage extends Page {

public static $has_many = array(
'GalleryImages' => 'GalleryImage'
);

public function getCMSFields() {

$fields = parent::getCMSFields();

$gridFieldConfig = GridFieldConfig_RecordEditor::create();
$gridFieldConfig->addComponent(new GridFieldBulkEditingTools());
$gridFieldConfig->addComponent(new GridFieldBulkImageUpload());
$gridFieldConfig->addComponent(new GridFieldSortableRows('SortOrder'));

$gridfield = new GridField("GalleryImages", "Gallery Images", $this->GalleryImages()->sort("SortOrder"), $gridFieldConfig);

$fields->addFieldToTab('Root.GalleryImages', $gridfield);

return $fields;
}
}

class GalleryPage_Controller extends Page_Controller {

public static $allowed_actions = array (
);

public function getGalleryImages() {
return $this->GalleryImages()->sort("SortOrder");
}
public function init() {
parent::init();
}

}

And GalleryImage.php is :

<?php

class GalleryImage extends DataObject {

public static $db = array(
'SortOrder' => 'Int',
'Title' => 'Varchar'
);

// One-to-one relationship with gallery page
public static $has_one = array(
'Image' => 'Image',
'GalleryPage' => 'GalleryPage'
);

// tidy up the CMS by not showing these fields
public function getCMSFields() {
$fields = parent::getCMSFields();
$fields->removeFieldFromTab("Root.Main","GalleryPageID");
$fields->removeFieldFromTab("Root.Main","SortOrder");
return $fields;
}

// Tell the datagrid what fields to show in the table
public static $summary_fields = array(
'ID' => 'ID',
'Title' => 'Title',
'Thumbnail' => 'Thumbnail'
'Link' => 'Link'

);

// this function creates the thumnail for the summary fields to use
public function getThumbnail() {
return $this->Image()->CMSThumbnail();
}

}

Please guide me how can i show the multiple galleries in a single page.

Thanks

Naren