make current album unclickable in menu?

Let me start out by saying I am a PHP beginner

I am using this code to print a very simple menu of all the toplevel albums in album.php (i am not using any subalbums in this particular project) :

`
<?php
set_context(ZP_INDEX);
while (next_album( true )): ?>
"><?php echo getAnnotatedAlbumTitle();?>

<?php endwhile;
set_context(ZP_ALBUM);?>
`
what i would like to do is make whatever is the current album unclickable in this menu? is this possible or will i have to use the print_album_menu plug-in to do something like this? if i do have to use print_album_menu how would i accomplish this?

thanks for any help you can give!

Comments

  • acrylian Administrator, Developer
    You can use the print_album_menu but on several user's request this keeps even selected items as clickable links (for easier usage in dropdown menus for example)

    Btw, you do this easier without setting contextes using the object model:
    `
    $toplevelalbums = $_zp_gallery->getAlbums();
    foreach($toplevelalbums as $album) {
    $obj = new Album($_zp_gallery,$album);
    (link stuff using the object model)
    }
    `
    You can check the current album within that by using the global of the current album: `$_zp_current_album`. So something like:
    `
    if($_zp_current_album->name == $obj->name) {

    } else {

    }
    `
    Note that the "name" is the unique value, not the title. Both are independent.
    Also see the object model tutorial.
  • thanks so much!
    i used that code and it seems to work fine. however i am not sure how to get the album URL from the album object? I am using the getTitle() function to print the album titles but I'm not sure what function I should use to print the album URLs. The function getAlbumLinkURL() only returns the URL of the current album.

    here is my code:

    `
    <?php
    $toplevelalbums = $_zp_gallery->getAlbums();
    foreach($toplevelalbums as $album) {
    $obj = new Album($_zp_gallery,$album);

    if($_zp_current_album->name == $obj->name) { ?>


    <?php echo $obj->getTitle(); ?>

    <?php } else { ?>

    "><?php echo $obj->getTitle();?>


    <?php } } ?>
    `
  • The Functions Documentation in the User Guide is very useful for stuff like this. :)

    http://www.zenphoto.org/documentation/classes/Album.html#methodgetAlbumLink
Sign In or Register to comment.