Member
Member
mjahkoh   2011-08-08, 08:28
#1
Which function would i use to know wether a folder is in the root folder (getAlbumFolder()).

Regards,
Jackson
Administrator
Administrator
acrylian   2011-08-08, 08:45
#2
That function gets the "albums" folder. If set to external on the config file it will get that.
Member
Member
mjahkoh   2011-08-08, 09:10
#3
Regards for your quick response.

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

Regards,
Jackson
Administrator
Administrator
acrylian   2011-08-08, 10:07
#4
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
Member
Member
sbillard   2011-08-08, 16:22
#5
If the album object's parent is NULL it is a root (first level) album. test for `is_null($obj->getParent())`
Member
Member
mjahkoh   2011-08-09, 14:20
#6
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
Administrator
Administrator
acrylian   2011-08-09, 14:45
#7
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.
Member
Member
mjahkoh   2011-08-10, 08:13
#8
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
Administrator
Administrator
acrylian   2011-08-10, 09:31
#9
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).
  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.