Elegant solution to too many Sub Albums...
|Posted: Wed, 2004-08-25 19:41|
This thread had a number of solutions to the problem of having too many sub-albums, however I didn't like any of them as they distracted from the feel of gallery. As a result I implemented some quick iframes changes to the source, which allows for a scrolling pane for the sub albums (if they are too big to fit in the cell), but keeps the style of the orginal gallery.
This change also speeds up the displaying of your root gallery because it doesn't have to recursively find all the sub albums on the page load. The iframes load seperately from the main page thus load after the fact.
A demo of the implementation can be found here: http://gallery.tvg.ca:8080/
To implement this is really simple.
1. Create a file called albumTree.php in your root gallery directory with the following code:
<?php require(dirname(__FILE__) . '/init.php'); $albumName = $_REQUEST['albumName']; ?> <html> <head> <?=common_header();?> <BASE target="_parent"> </head> <body class="albumdesc"> <?=printChildren($albumName);?> </body> </html>
2. Open album.php in your root gallery folder and find the following line (in version 1.4.4 (pl1, not sure) it is on line 396:
And you are done, that simple. If you want, you can change the height of the iframe from "100%" to something suitable for your gallery skin, ie I use "200".
Let me know what you think and if you have any changes/additions.