Using only one album

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 think that others have done something like this. I suggest you search the forum to see what has been posted.
  • sbillard thank you, i gonna search.
    I realize that i need to change in index.php (not in template) right? But i still getting errors.
  • You need to create an index.php file with much the same structure as the album.php file but instead of a next_album() loop you need to do something like:

    `$albums = $_zp_current_gallery->getAlbums();

    $_zp_current_album = new Album($_zp_current_gallery, $albums[0]);`

    Note that I have not tried this myself.
  • i take off <?php while (next_album()): ?> (and the content between?) <?php endwhile; ?> ?

    Sorry, i'm pretty newbie in php...
  • Yes
  • it doesn't work :/
  • A working single album based on the default theme. Use this as the index.php script.

    `<?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_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 printRSSLink('Album', '', gettext('Album RSS'), ''); ?> | ?p=archive"><?php echo gettext("Archive View"); ?> | <?php echo gettext("Powered by"); ?> ">zenphoto


    <?php printAdminToolbox(); ?>



    `
  • the best support ever. :)
  • Joen Member
    This is very nice, and does almost what I have in mind.

    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.
  • It is yours to do what ever you want with. Look through our documentation. I am sure you will find the support functions you need.http://www.zenphoto.org/category/User-Guide/
  • Joen Member
    I guess I'll try and adopt some code from the rss.php file. I'll let the forum know whether I manage to add pagination to that.

    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 :)
  • acrylian Administrator, Developer
    I think that depends what you want to do..:-) I am fine with the normal albums as categories, but I can see the use of it, wether it is in order or just latest to oldest.

    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..:-))
  • Joen Member
    Acrylian,

    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)): ?>



    <?php endwhile; ?>





    <?<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!
  • jackie Member
    Hi - I'm trying (hate to admit how many hrs!) to get one album on a page, regular php page in my site, altho I have many albums in the gallery. Each page of my site needs a specific album... or 2.
    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
  • acrylian Administrator, Developer
    Why don't you just link directly into an album?
  • jackie Member
    Thank you acrylian for your response.
    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.
  • What do you mean "calling it by name"? As acrylian said you can create a direct link to www.mydomain.com/zenphoto/album which will display that album. You can also create code that does the same thing as album.php to display the album in place.
  • jackie Member
    By 'calling it by name' I meant a possible function that would display the album within another page ( like a link would) - but that's actually what your code above does. Where you could pass the album folder name as a parameter. However I have it ok now -
    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.
  • edbury Member
    Joen, could you post the entirety of that file?
  • edbury Member
    Actually. I suppose I have a different request anyway.

    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").
  • bump
  • Is there any information on making this work with 1.3.x? The code posted doesn't appear to apply to the 1.3 version that I'm currently using.
  • acrylian Administrator, Developer
    Probably that is because the method `getSubAlbums()` has been replaced by `getAlbums()`.
  • so.... it is or isn't possible with 1.3x? if it is, then how do we accomplish it under 1.3?
  • The best way to know is to try it out. (You'll just have to make the change sbillard indicated.)
Sign In or Register to comment.