And depending on your needs, you may be able to modify these SQL counting functions to fit your needs. I use them for my custom album, subalbums counts on my zenphoto pages.
`/* SQL Counting Functions */
function show_subalbum_count() {
$sql = "SELECT COUNT(id) FROM ". prefix("albums") ." WHERE parentid <> \"NULL\"";
$result = query($sql);
$count = mysql_result($result, 0);
echo $count;
}
function getIDforAlbum() {
if(!in_context(ZP_ALBUM)) return false;
global $_zp_current_album;
return $_zp_current_album->getAlbumID();
}
function show_sub_count_index() {
$id = getIDforAlbum();
$sql = "SELECT COUNT(*) FROM ". prefix("albums") ." WHERE parentid = $id";
$result = query($sql);
$count = mysql_result($result, 0);
echo $count;
}`