Hi, i want to use Zenphoto wih one album only.
And i want to show the thumbnails of this album in index.php...
I tried to copy album.php (i'm using default template) to index.php but i get error.
How can i make this works? I want to update only one album and show the latest thumbnails in index.php
Thanks in advance!
Comments
I realize that i need to change in index.php (not in template) right? But i still getting errors.
`$albums = $_zp_current_gallery->getAlbums();
$_zp_current_album = new Album($_zp_current_gallery, $albums[0]);`
Note that I have not tried this myself.
Sorry, i'm pretty newbie in php...
`<?php if (!defined('WEBPATH')) die(); $themeResult = getTheme($zenCSS, $themeColor, 'light'); $firstPageImages = normalizeColumns('2', '6');?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/2002/REC-xhtml1-20020801/DTD/xhtml1-transitional.dtd">
<?php zenJavascript(); ?>
<?php printGalleryTitle(); ?>
" type="text/css" />
<?php printRSSHeaderLink('Gallery',gettext('Gallery RSS')); ?>
<?php if (getOption('Allow_search')) { printSearchForm(''); } ?>
<?php printHomeLink('', ' | '); echo getGalleryTitle(); ?>
<?php<br />
$albums = $_zp_gallery->getAlbums();
$_zp_current_album = new Album($_zp_gallery, $albums[0]);
set_context(ZP_INDEX | ZP_ALBUM);
?>
<?php while (next_album()){ ?>
" title="<?php echo gettext('View album:'); ?> <?php echo getAlbumTitle();?>"><?php printAlbumThumbImage(getAlbumTitle()); ?>
" title="<?php echo gettext('View album:'); ?> <?php echo getAlbumTitle();?>"><?php printAlbumTitle(); ?>
<?php printAlbumDate(""); ?><?php printAlbumDesc(); ?>
<?php } ?>
<?php while (next_image(false, $firstPageImages)): ?>
<?php endwhile; ?>
<?php printPageListWithNav("« ".gettext("prev"), gettext("next")." »"); ?>
<?php printTags('links', gettext('<strong>Tags:').' ', 'taglist', ''); ?>
<?php if (function_exists('printSlideShowLink')) printSlideShowLink(gettext('View Slideshow')); ?>
<?php if (function_exists('printAlbumRating')) { printAlbumRating(); }?>
<?php printAdminToolbox(); ?>
`
Can it be extended, though?
I'm looking for a Flickr like "stream of all images". Basically, i would like for index.php to simply show the contents of ALL folders in one continously paginated sequence, ideally a sequence that respects the individual folder sorting order.
That said, my guess was that zenphoto had such a function built-in; it seems to me that a flat, paginated view containing every picture is a userfriendly way of showing a gallery. Benefits include giving people an idea of how many pictures there are in total, how new the pictures are (page 1 means newest) and so on. I would guess that's why Flickr has that as its default view. Asking here, whether such a function existed seemed like a shortcut at the time, my being stumped at what keyword(s) to search for.
Thanks for taking your time to reply here, and let me know if there's anything I can help you with, to pay back for the time the whole zp team spend here. I'm proficient in design and usability
For the latter the rss feed is a good start.
If you want the images in album order and not lastest first here is a short round up for the first subalbum level:
`global $_zp_gallery;
$gallery = $_zp_gallery;
$albums = $_zp_gallery->getAlbums();
// gets every top level album within this you can get the images with $topalbum->getImages()
foreach ($albums as $toplevelalbum) {
$topalbum = new Album($gallery,$toplevelalbum,true);
$subalbums1 = $topalbum->getSubAlbums();
foreach($subalbums1 as $sublevelalbum1) { // gets every sub level album of the current top level one in the loop.
$subalbum1 = new Album($gallery,$sublevelalbum1,true);
}
}`
Within the subalbums1 foreach you can do it all again so you get the next subalbum level and so on (I do this with the printalbumenu up to the 4th level - And before anyone says anything, yes I know that actually should be done rekursively some time, but the direct way was faster for me and 4 levels are actually enough usability wise..:-))
That seems to work perfectly! I had to tweak it a bit. Here's what I have:
`
<?php<br />
global $_zp_gallery;
$gallery = $_zp_gallery;
$albums = $_zp_gallery->getAlbums();
// gets every top level album within this you can get the images with $topalbum->getImages()
foreach ($albums as $toplevelalbum) {
$topalbum = new Album($gallery,$toplevelalbum,true);
$subalbums1 = $topalbum->getSubAlbums();
foreach($subalbums1 as $sublevelalbum1) { // gets every sub level album of the current top level one in the loop.
$subalbum1 = new Album($gallery,$sublevelalbum1,true);
$_zp_current_album = $subalbum1;
set_context(ZP_INDEX | ZP_ALBUM);
?>
<?php while (next_image(false, $firstPageImages)): ?>
" title="<?php echo getImageTitle();?>">
<?php printImageThumb(getImageTitle()); ?>
<?php endwhile; ?>
<?php while (next_album()){ ?>
" title="<?php echo gettext('View album:'); ?> <?php echo getAlbumTitle();?>"><?php printAlbumTitle(); ?>
<?php printAlbumDate(""); ?><?php printAlbumDesc(); ?>
<?php } ?>
<?<br />
}
}
?>
`
Edit: The only thing it seems to be "missing" is the pagination -- it doesn't obey the "galleries per page", nor does it seem to add pagination, but I can live with that. And the sorting works! Excellent.
Keep that design/usability review favor in mind, I'd like to help again.
Edit 2: Actually that pagination problem was me being stupid. Pagination DOES work, it just doesn't take its pagination info from "albums per page" but from "images per page". Woo!
I have the code from above "single album" working... I have only 2 albums in the gallery now but notice that the array #0 is the second one I set up, and #1 is the first (?)
But my question is: is there a way to display a specific album on a php page calling it by name, by the album's $folder name?
thank you
Jackie
yes - I can do that - but I wanted it to display in a spry tabbed panel on the page. (Don't we always want the 'next' thing?)
I think the code posted above will do that for me but I was wondering if there was a way to display one album by calling it by name.
I am using your 'one album' code - which displays the thumbnails and then the user can click into the album.
Thanks for the help and it's a great app. Once I read more of the core code functions I'll know more how it works.
How could I set this up so that the photostream grabs all of the photos from all top-level albums (I won't have any subalbums), and displays them latest first?
Secondly, it'd be cool to have the option to still grab the albums and display them on the side (I'm thinking something similar to Flickr's "sets").