Is there a function to get albums according to their tags? If I have four albums with a tag of 'favourite' for example, how could I retrieve just those four? I'm building a custom page, hence the request.
I had a look through the functions documentation but searching on 'tags' gives too many false positives as each function description has a tag.
Thanks,
Ed.
Comments
Or perhaps you did not limit the search to just the tag field? I also really do not understand what you mean by "each description has a tag". Tags apply to objects, not fields.
I've tagged four albums with a 'Europe' tag which works as expected - I can search for them using the search page, click on the tag etc and I get the correct four albums.
What I'd like to do is create a custom page which gets those same four albums so I can display their titles in an unordered list, creating a summary page of albums per continent. This is a bit like the print_album_menu function but only for albums with a specific tag. I'm trying to replicate a page on my old site (http://www.thefunkysite.com/travels/Travels.asp) if that helps clarify?
It's only when searching the function documentation (zenphoto.org/documentation/elementindex.html) for the keyword 'tag' that I get lots of hits, hence asking if you can help identify available functions for working with tags.
I'd like to avoid a dynamic album if possible because my homepage shows all albums and I don't want these showing on the homepage.
Thanks again,
Ed.
Since you can direclty link to any unpublished item you also have your custom page actually. if you need another layout use the multiple_layouts plugin for example.
Since it is an album you can also use the object model on a theme custom page to display.
Can someone point me in the right direction?
If you need a specific custom theme page with a specific layout your need to make the album current (there is a function for that named accordingly) on that custom theme page and then you can just use the next_album loop as on album.php. Alternatively you can use the object model directly.
Acrylian's said there's a function to make an album current but I can't find it. Can anyone please give me a function name or ideally some code? All I want to do is retrieve five dynamic albums and list the names of the albums and subalbums (ie an index page). Surely it can't be that hard?
I've tried looking through the function documentation but all the getAlbum functions seem to act on the current album (which I don't know how to set).
I've read the object model introduction but it simply states that '$_zp_current_album is setup in album context as within the next_album() loop or on a theme's album.php'. I don't want to loop through all the albums, I just want to set it to a named dynamic album. I had a look at the print_album_menu.php code which uses getManagedAlbumList() but I think that returns an array of objects and I still don't know how to set the current album to one of those objects. I'm not fussed whether I use the object model or a prebuild function - whichever gets the job done is fine by me.
Help please! It only took me a few evenings to get a new hosted site up and running with all my galleries imported and to modify the HTML/CSS but I've now spent four evenings making zero progress because I can't work out a couple of lines of code. I understand PHP, CSS, HTML etc but I'm struggling to understand the logic flow for Zenphoto. I'm getting to the point where I'll happily pay someone to do this for me as my wife is due with our first baby in three weeks and I won't have any time to spend on tweaking my website...
I really do appreciate the quick answers everyone's given and I'm sorry if this sounds like a rant but I think sometimes the developers forget how much they know about Zenphoto and how hard it can be for a newcomer. Saying 'make your album current' is no doubt simple for you, but hours of searching forums and documentation for me! I'm serious about the payment too, within reasonable limits.
Thanks,
Ed.
The function is named makeAlbumCurrent(). We try to name all speaking. You easily find it on our functions documentation if you follow the links and tips here: http://www.zenphoto.org/news/functions-documentation
Tha function will setup the global $_zp_current_album.
As already said the easiest is to link the album in question directly then all is already setup. You can link to any unpublished item (be it image, news or page) directly, it just does not appear in menus or loops.
If you need another layout for that, try the multiple_layouts plugin to assign a specifically created album page layout.
I'm still stuck however. To use makeAlbumCurrent I have to pass an album object which means I need to retrieve the dynamic album first. Having looked previously the only function with 'dynamic' keyword is 'hasDynamicAlbumSuffix' and the getAlbum functions all seem to work on the current album, which I can't set. Dynamic albums don't seem to generate an actual folder structure either. Aaaarrgh! I'm sure once I've set the album to current I can manage the rest but everything seems to be geared around the idea you have an album in context. I think i must be missing some basic concepts because every step is not intuitive for me.
Can you give me a code example for getting the dynamic album? I don't want to be led by the hand but neither can I spend days trying to become a full time Zenphoto developer. Do I need to run a search function and use GetAlbumList? I found an old forum post (five years ago) that that uses a mysql_fetch but I'm guessing that's no longer relevant.
If you wish to create that environment you need to do:
`
zp_load_album();
prepareAlbumPage();
`
Now you have the normal album environment and you can use the object model or the template functions as $_zp_current_album is setup.
This is not possible on older Zenphoto versions than 1.4.3. Before it only works with static albums and this was added because I needed it as well. I will add this to the tutorial for dynamic albums.
But let me repeat the question why you don't just link to the album as that does all this already.
PS: Here is the updated tutorial: http://www.zenphoto.org/news/how-to-use-the-dynamic-albums-feature#setting-up-the-dynamic-album-context-manually
I'm not linking to the dynamic album directly because I want to list a summary of several dynamic albums on a single page. Hope that makes sense. Have a great weekend,
Regards,
Ed.