7912 Posts in 1355 Topics by 930 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » [SOLVED] [Image Gallery] Get the first album into the ImageGalleryPage
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 1049 Views |
-
[SOLVED] [Image Gallery] Get the first album into the ImageGalleryPage

18 August 2009 at 2:26am Last edited: 18 August 2009 4:46am
Hi everybody,
I'd like to customize a bit the ImageGallery Page but I can't figure it out...
The default behavior:
When you arrive on an ImageGallery Page, it displays eather an albums list (if several albums) or directly the album if the Gallery include just one album.The behavior that I'm trying to get:
When there is several albums, I would like to display the first album of the Galery directly.See in action:
Here is a ImageGallery Page with two albums : http://silver.francesca-avossa.com/stand-2/
You need to click on "M&O 2008" or "M&E 2009" to display an album. Instead of doing that, I would like to be directly in the first album of the Galery.Any ideas of how I can do that ?
Many thanks in advance.
-
Re: [SOLVED] [Image Gallery] Get the first album into the ImageGalleryPage

18 August 2009 at 3:23am
Create a new class, MyImageGalleryPage extends ImageGalleryPage
MyImageGalleryPage_Controller extends ImageGalleryPage_Controller
{
function index() {
Director::redirect($this->Albums()->First()->Link());
}
} -
Re: [SOLVED] [Image Gallery] Get the first album into the ImageGalleryPage

18 August 2009 at 3:54am Last edited: 18 August 2009 3:55am
Thank you UncleCheese, it works perfectly ! (cf http://silver.francesca-avossa.com/new-myimagegallerypage/ )
Just a quick question:
If I go into the Behavior tab of my ImageGalleryPages, I select my new type of page "MyImageGalleryPage" and I do a db/build?flush=1, the redirection doesn't work. It only works when I create a fresh new MyImageGallery Page. It means I will need to re-create all the ImageGalleryPage with this new type of page.Do you know how I can avoid that ?
Thanks again.
-
Re: [SOLVED] [Image Gallery] Get the first album into the ImageGalleryPage

18 August 2009 at 4:36am
Hmm.. That doesn't make any sense to me. Something isn't right.
FYI, you should be using /dev/build, not db/build?flush=1.
-
Re: [SOLVED] [Image Gallery] Get the first album into the ImageGalleryPage

18 August 2009 at 4:45am
Ok, nevermind. I'll figure it out.
Thanks again for your time.
| 1049 Views | ||
|
Page:
1
|
Go to Top |

