Printing an album menu from a specific subdirectory

I'm using the `printAlbumMenuListAlbum` in order to print an albums menu on each page of the gallery.

I don't want it be context sensitive (visitors should have access to the whole gallery from anywhere they are) but I would like to restrict it to one branch of the `albums` folder. That's because I've separated:
- pictures that are 'real' photographies and will be displayed in the gallery part
- anything else (specific albums, that is) that could be used in Zenpages pages.

I've searched for some kind of parameter to instruct `printAlbumMenuListAlbum` to begin for a special 'node' of the albums tree, but didn't find anything; it's either the whole gallery (= all the albums) or context sensitive.

Could you give me some advice on the matter?
Thanks.

Comments

  • acrylian Administrator, Developer
    I am not sure I understood. There is an option to display only the sub albums for an album and omit the top level. So if you have two top level albums "album1" and "album2" it would just display the sub level of those if within those albums and their childs.
    http://www.zenphoto.org/documentation/plugins/_zp-extensions---print_album_menu.php.html#functionprintAlbumMenu
    "omit-top" or for jus the sublevels of the current album "list-subs".

    If you need more specific menus or behaviour you need to either use the menu manager plugin with several menu sets or create a custom function.
  • First line of the link you produced says:
    "Prints a list of all albums context sensitive." so this won't work as I want to display the same subtree on all the pages of the gallery.

    The album element - unless I'm mistaken - only returns a link to a specific album.

    What I'm looking for is a combination of both: a whole menu album starting from the one I choose down to the lowest levels.

    I think I need to adapt the `printAlbumMenu` but I don't know how to tell my function where to start from; it's neither the top level, nor the current album. How can I specify the album I want it to start from? id? or name? Which parameter should I need to modify?
  • acrylian Administrator, Developer
    If your branches are topl level ones "omit top" does what you want. Within that it folds out context sensitive as usual. Unless you enable it to show all levels always.

    This is a quite complicated plugin especially because getting the nested html list correctly done although it "just prints" a list. What you want might be not that easy.

    It might be easier to write a simple custom function if you know your album level depth. In any case you need to use/get into the object model and thus always have to use the album name. The id has no role in the object model.
  • What I currently have is the whole albums list here: whole list.
    What I would like is the non-greyed part only, so it is all the albums downwards from one of the top-level called 'Galerie'.
  • acrylian Administrator, Developer
    That is not possible with the album menu plugin. You could try some jQuery magic to hide the other toplevel tree though maybe.

    Otherwise you would be better off using the menu manager then.
  • Well, thanks for having a look. I'll thing about it.
  • Should have thought about it sooner: the solution is to instantiate a new gallery object which root is the highest level album containing my photos, then call the `printAlbumMenuListAlbum` for this sub-gallery.
    Here it is:

    `
    $myPhotos = new Album($_zp_gallery, 'galerie/');
    $albums = $myPhotos->getAlbums();

    printAlbumMenuListAlbum($albums, $albumpath, $currentfolder, $option, $showcount, $showsubs, $css_class, $css_class_topactive, $css_class_active,$firstimagelink,$keeptopactive,$limit);
    `
  • acrylian Administrator, Developer
    Even I haven't thought about that helper function… Btw, you don't instaniate a "gallery object" (means the whole site in ZP terms) but an "album object".

    On 1.4.5 you should use the function `newAlbum()` instead of the class constructor directly.
  • Thanks for the advice, I will change that. In fact, I had copied/pasted some code written a few months ago for my home page, and didn't realized 1.4.5 brings new functions in that department.
  • acrylian Administrator, Developer
    What you did does work of course, but the new function is a bit saver (there is an equivalent for the image class constructor, too).
Sign In or Register to comment.