Counting Albums and Subalbums

Tris-

I have an off the wall question for you:

I have built a custom SQL query to count the subalbums. It works fine for the root index page, telling me how many subalbums there are total. (I pull everything not NULL in the query from parentid. If it has a NULL in it, then it's apparent that it is a parent - har har)

Anyway, I made an attempt to do the same thing within an album, so for each thumb displayed on the main screen (in the JoshuaInk theme), when you mouse over the thumb, it will show how many images in the album, plus how many subalbums there are. For some reason, it doesn't work as well. Any thoughts on the besy way to proceed with this further?

Just fiddling with it, absolutely not top shelf priority at all.

And check your email at trisweb.com. I sent you something relating to USB keys. :)

Comments

  • OK. I got it. Finally. Had to create a custom function to query the current album's ID, and then run a SQL query to get the subalbum count of the current "root" album to display it.

    So in essence, when you run your mouse over the images of the root album, you get a display of the description, plus the amount of images in the root of each album, plus a count of each albums subalbums.

    One could probably extend this in a myriad of ways.

    If anyone wants the code, I'd be glad to share.
  • trisweb Administrator
    That sounds good! Yeah, you basically need to query 'parentid' for the current album ID. That's available as $album->id, just FYI.

    Image counts in the current album should already be available, but I'll add a subalbum count as well just for fun.

    I did get your USB key message! Thanks! I'll let you know if I want one, but I really don't use them very often... I'll think about it.
Sign In or Register to comment.