![]() |
|
Any subalbums in this album ? - 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: Any subalbums in this album ? (/thread-959.html) |
Any subalbums in this album ? - edasque - 2006-12-12 In my current theme, I use: to check if there are images in this album. Is getNumAlbums the equivalent to see if the album has subalbums ? If not, is there an equivalent ? It seems getNumbAlbums returns the total number of albums, without context. Any subalbums in this album ? - edasque - 2006-12-12 getNumAlbums returns the number of TOPLEVEL albums, I don't know that there are an equivalent for counting the sub albums, is there ? Any subalbums in this album ? - thinkdreams - 2006-12-12 Check my theme edasque here, and I also have a recent post about counting subalbums. I display on the main index a count of albums and subalbums total, then in each album (mouse over each album image) it will display a count of how many images in the root album + how many subalbums there are. Is that close to what you were looking for? If so, I'd happy to post the code. Any subalbums in this album ? - edasque - 2006-12-12 Yes the counting will be very useful. I'd love to get my hands on "Latest Images", "Latest Subalbums", "Most Popular", "Highest Rated" and rating features as well Any subalbums in this album ? - thinkdreams - 2006-12-12 Heh. Wondered when someone was going to ask. The Latest Images and Subalbums are easy. The Most Popular and Highest Rated involve minor database changes, relating to hit counts and star rating systems, both of which have forum posts here. Still interested? The only reason I ask is that some people don't want to modify their DB. I'll have to package them up for you too, because it involves a few files, and then some DB changes, and then some CSS tweaking, and etc.... Here's the counting functions: `/ SQL Counting Functions / function show_subalbum_count() {
$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() {
$count = mysql_result($result, 0); echo $count; }` Now mind, the latest albums/subalbums and the latest images were not developed by me but by this nice gentleman here, and I tweaked them a bit. But these are the functions. Don't forget the Most Popular and Highest Rated require additional work, so don't call them unless you have the changes in place mentioned above, but basically they are just versions of the latest images. `/ Show Latest Albums / / http://anton.gektoras.lt/zenphoto/zenphoto-latest-albums /
`/ Show Latest Images / / http://anton.gektoras.lt/zenphoto/zenphoto-latest-images /
/ Show Most Popular Images / / Modified from show_latest_images from http://anton.gektoras.lt/zenphoto/zenphoto-latest-images /
/ Show Highest Rated Images / / Modified from show_latest_images from http://anton.gektoras.lt/zenphoto/zenphoto-latest-images /
Any subalbums in this album ? - trisweb - 2006-12-12 Just FYI, you can technically include this code with your themes without modifying Zenphoto. You just need to have a line like:
at the top of your theme pages where you use the functions. That way we don't get into modifying zenphoto's actual code. I could even come up with a convention, and always include a 'hacks.php' if it's present in the theme, or any name you guys want... It would be nice before we have a plugin system I think. Any subalbums in this album ? - edasque - 2006-12-12 yes, that's what I am doing. I run a modified version of Effervescence which contains a customfunctions.php I append to. Any subalbums in this album ? - trisweb - 2006-12-12 Excellent :-) Just making sure. Any subalbums in this album ? - thinkdreams - 2006-12-12 Since I'm using a modified Joshuaink, I use the joshuaink.php to hold all my custom functions, so it's basically what you suggested. A wise course of action, that way your not editing all your base files. A hacks.php file would be a great thing to include in the base files, so that you can just store your stuff in that file in your theme. This makes it a lot quicker and cleaner when doing upgrades too. Can't wait for plugins, then I can get the custom code out of the i.php file, and then none of my mods affect any of the zen core files. The only other thing to note is about custom DB changes. How would that work? e.g. the rating system and hit count require DB changes, so you'd have to come up with some sort of plugin modification system like Wordpress has to make changes to the DB, which I guess could be done during plugin load (does that make sense?) Any subalbums in this album ? - trisweb - 2006-12-12 Absolutely, new database columns could be made during plugin initialization. |