![]() |
|
Check wether Album is in Root folder - 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: Check wether Album is in Root folder (/thread-8951.html) |
Check wether Album is in Root folder - mjahkoh - 2011-08-08 Which function would i use to know wether a folder is in the root folder (getAlbumFolder()). Regards, Jackson Check wether Album is in Root folder - acrylian - 2011-08-08 That function gets the "albums" folder. If set to external on the config file it will get that. Check wether Album is in Root folder - mjahkoh - 2011-08-08 Regards for your quick response. I meant to check wether a folder is in the albumfolder (getAlbumFolder()). Regards, Jackson Check wether Album is in Root folder - acrylian - 2011-08-08 You mean if you actually have albums? http://www.zenphoto.org/documentation/classes/Gallery.html#methodgetNumAlbums http://www.zenphoto.org/documentation/functions/_template-functions.php.html#functiongetNumAlbums Check wether Album is in Root folder - sbillard - 2011-08-08 If the album object's parent is NULL it is a root (first level) album. test for `is_null($obj->getParent())` Check wether Album is in Root folder - mjahkoh - 2011-08-09 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 Check wether Album is in Root folder - acrylian - 2011-08-09 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. Check wether Album is in Root folder - mjahkoh - 2011-08-10 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 Check wether Album is in Root folder - acrylian - 2011-08-10 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 == '<folder name to check>') { <do something> } } ` Or just try to create the object...if the album is not there it will not work (you can check with $obj->exists btw). |