zenphoto forums » Usage Support

How to split thumbs to multiple pages?

(8 posts)
  1. weeman

    Junior
    Joined: Aug '08
    Posts: 7

    Hello,

    I'm using some of the Zenphoto functions to embed features into my existing webpages. Basically, this is what I'm doing so far:


    zp_load_gallery();
    zp_load_album('test');
    while(next_image(true)) {
    print('<img src="' . getImageThumb(getImageTitle()) . '">');
    }

    This works fine for displaying every thumbnail of the album on a single page. However, I just don't understand how to seperate this "display as one page" into multiple pages showing e.g. 5 thumbs per page.

    I tried modifying the above to:


    $i = normalizeColumns('1','5')
    while(next_image(false, $i)) {
    print('<img src="' . getImageThumb(getImageTitle()) . '">');
    }

    But the only effect is that no thumbs are displayed at all. Could someone assist me?

    Robert

    Posted 3 years ago #
  2. Zenphoto development team
    sbillard

    Chief Developer
    Joined: May '07
    Posts: 9,766

    Pagination in Zenphoto is integrally built into the normal way Zenphoto works (loading pages via the index.php script.) You will need to pretty much setup the "normal" Zenphoto environment. Seems to me that you would be better off just using that environment in the first place.

    Anyway, since it seems you are not putting album thumbs on the page you do not need the normalizeColumns() part. You can use just next_image(). You will also need to manage the Zenphoto page# variables.

    Don't forget to read the Forum rules and usage resources
    Posted 3 years ago #
  3. weeman

    Junior
    Joined: Aug '08
    Posts: 7

    Thanks for the info. Yes, I think you're right. I changed my approach to making a theme which makes handling the Zenphoto functions a lot easier.

    Due to using a theme however, there are some new issues I have to figure out. Basically, this is what I want my theme/page to do:

    1. index.php
    The main page shall create links to the albums. For this, I'm using

    while (next_album(true)) {
    print('<li>Link to album</li>
    ');
    }

    which works fine.

    2. album.php
    This page shall show all thumbnails for the images which is working fine as well with

    next_image()
    . But here's the problem:

    This page shall also show the links to all albums as mentioned in 1. However, the next_album() function is not available as album.php seems already to be operating in an album.

    Do you have any hint for this? Hopefully, my question is not too confusing? :-)

    Posted 3 years ago #
  4. Zenphoto development team
    acrylian

    Developer
    Joined: Jul '07
    Posts: 13,346

    I assume you read or theming tutorial? If there is no next_album loop on your album.php then there is no listing of albums. What theme are you using as a base. Or maybe post a link to your site, otherwise we are guessing.

    Don't forget to read the Forum rules and usage resources
    Posted 3 years ago #
  5. weeman

    Junior
    Joined: Aug '08
    Posts: 7

    Yes, I've read the tutorial. I'm using the default Zenphoto theme as a base referring to my own CSS for the layout.

    Actually, all I need to know is if there is a way to access all album titles from within the album.php :-)

    Posted 3 years ago #
  6. Zenphoto development team
    sbillard

    Chief Developer
    Joined: May '07
    Posts: 9,766

    Album objects contain the descriptions. I am not clear on what you want to do, but if it is to just list the descriptions of the albums in a subalbum you would have to use the next album loop (assuming you are on an album page) an only display the descriptions.

    If you want something different you will have to program that using the zenphoto object model.

    Don't forget to read the Forum rules and usage resources
    Posted 3 years ago #
  7. weeman

    Junior
    Joined: Aug '08
    Posts: 7

    Sorry for my unclear question :-)

    The point is:
    There is an area on my page which shows links to the albums (subalbums are not used). This navigation list is generated by index.php using the next_album() function. The same navigation list, however, shall be also displayed on the album.php page which contains all the thumbnails using next_image().

    I made a workaround to achieve this:

    • When album.php is loaded, the current album title is stored in a temporary variable $tempAlbumName.
    • Recalling zp_load_gallery() and next_album() to insert the album titles into the navigation.
    • Reloading the album with zp_load_album($tempAlbumName) followed by the next_image() function for the thumbnails.

    I bet there are more elegant and optimized ways to get the same behavior but this is what I could figure out.

    Merry Christmas :-)

    Posted 3 years ago #
  8. Zenphoto development team
    acrylian

    Developer
    Joined: Jul '07
    Posts: 13,346

    zp_load_album($tempAlbumName) sets up a global variable named $_zp_current_album that contains the object of that album which contains all info. You should take a look at our list of globals and the functions documentation of the classes.

    next_album is context sensitive so if you want to show all albums always you have to use the object model. The print_album_menu plugin does perhaps do what you want but without thumbnails.

    Don't forget to read the Forum rules and usage resources
    Posted 3 years ago #

RSS feed for this topic

Reply

You must log in to post.