ZenphotoCMS Forum
Customised gallery on the front page - Printable Version

+- ZenphotoCMS Forum (https://forum.zenphoto.org)
+-- Forum: Support (https://forum.zenphoto.org/forum-1.html)
+--- Forum: General support (https://forum.zenphoto.org/forum-4.html)
+--- Thread: Customised gallery on the front page (/thread-8239.html)



Customised gallery on the front page - gromit - 2011-02-12

Hi,
Firstly, thanks for Zenphoto - I love it

Secondly...
I love having the gallery on the front page. However, I'd like to be able to have a different collection of albums on the front page (index.php) than the main gallery.
My main reason is to have a few portfolio albums on the front page, with all other albums showing up in the main gallery page.
Is this possible in a neat way (e.g. showing a collection of sub albums) or will I need to copy the gallery.php code and hack it around for the index page?

I'm using zpgallerific if that helps!

Many thanks in advance!




Customised gallery on the front page - acrylian - 2011-02-12

Please read the theming and the object model tutorial.




Customised gallery on the front page - gromit - 2011-02-14

Thank you.
Dumb question time - can I set $_zp_current_album manually?
I'm trying to call printCustomAlbumThumbImage() but it obviously needs the current album setting, and I'm trying to do this manually.




Customised gallery on the front page - sbillard - 2011-02-15

Yes, of course. But don't do it in the "wrong" place--that is when it has been setup otherwise for some loop. You should check the function makeAlbumCurrent() as it is probably what you want. (Don't hold me to the spelling--I did not look it up.)




Customised gallery on the front page - gromit - 2011-02-19

That seems to be exactly what I want - thanks!

However, I can't get it to work, and I'm not sure why....
A quick demo:
If I used the code
'

'
Then it returns 'weddings' on the page

But if I set it manually:
'

'
It returns with:
'
Fatal error: Call to a member function getTitle() on a non-object in /home/photog/public_html/zp-core/template-functions.php on line 84
'

I'm not sure what I'm doing wrong - I've tried the album title as a bare string, with ' and with " and also the album ID from the database. All have the same results.

Help?!




Customised gallery on the front page - acrylian - 2011-02-19

Yes, you should probably read the documentation more carefully. makeAlbumCurrent() requires the album object. This needs to be created before using this. You NEVER use the title of anything for this but the name

Within the next_album loop the current album is setup anyway for each album listed. If you want to use the next_album loop within an album for its subalbums you have to setup its album object before the loop naturally.

Recommended read:
http://www.zenphoto.org/2010/02/zenphotos-object-model-framework/




Customised gallery on the front page - gromit - 2011-02-20

D'oh! I was being rather silly and have been looking at the theme .php files only...