Check wether Album is in Root folder

Which function would i use to know wether a folder is in the root folder (getAlbumFolder()).

Regards,
Jackson

Comments

  • acrylian Administrator, Developer
    That function gets the "albums" folder. If set to external on the config file it will get that.
  • Regards for your quick response.

    I meant to check wether a folder is in the albumfolder (getAlbumFolder()).

    Regards,
    Jackson
  • If the album object's parent is NULL it is a root (first level) album. test for `is_null($obj->getParent())`
  • Thanks for your quick response.

    I used this and works;

    if ($_zp_current_album->gallery->albumdir.$_zp_current_album->name."/"===$_zp_current_album->localpath) {//do something }

    Regards
    JACKSON
  • acrylian Administrator, Developer
    I am not sure I understand what you want to do actually. $_zp_gallery->getNumAlbums() gets you the number of toplevel albums, thus if there are albums in the /albums folder at all.
  • Thanks Acrylian for your quick one. Anyway what i intended to do was check wether a certain folder eg 'windows' existed in the albums folder. Thanks a million
  • acrylian Administrator, Developer
    Ok, but your codes uses $_zp_current_album. So that album apparently exists why the check does not make real sense to me...

    The way to check for a toplevel album existing is to use the object model.
    `
    $albums = $_zp_gallery->getAlbums();
    foreach($albums as $album) {
    if($album == '') {

    }
    }
    `
    Or just try to create the object...if the album is not there it will not work (you can check with $obj->exists btw).
Sign In or Register to comment.