Album Next Page PHP Error

Hi all,

Can you help offer insight on what is causing this error when trying to access page 2+ on the album pages?

`
PHP Notice: printField() invalid function call. in /zp-core/template-functions.php on line 1440
PHP Fatal error: Call to a member function getImages() on a non-object in /zp-core/template-functions.php on line 1968
`

Comments

  • Only if you can provide details of your install such as Zenphoto version, PHP version, etc.
  • PHP: PHP 5.3.3
    Zenphoto: Zenphoto version 1.4.4.8 [4fd3c047c8] (Official build)

    Interestingly enough it works on the default theme, but not working in this theme.

    The call in the theme it's trying to do is
    `<?php if (getNextPageURL()) { ?>">Next Page <?php } ?>`

    Wondering if something is missing in the album.php logic?
  • Again, how about a little help with helping you? "this theme" is what exactly?

    Anyway if it is working in the distributed themes then it is an error in whatever theme you are using. Maybe if you identify it the author might step in.
  • Yeah, sorry. zpMasonry (but am working on modifying it). Winmerge shows mostly everything is the same, so I'm not sure where the page 2+ logic comes in to play.

    Author is a bit MIA and since I'm customizing it anyways, I'm on my own. Can you point me to a solid rtfm on this?
  • Sure: http://www.zenphoto.org/news/category/user-guide

    Basically, you have tried those functions out of context.
  • Ok, suppose I'll start over and start removing items one by one again.
  • Found my error. Instead of showing subfolders as thumbnails, I'm trying to display them as folders in a sidebar. When going to page 2+, it's erroring the above errors in my original post when trying to load this code below while on page 2+.

    I assume it's because when you're on page 2, there's no subfolders to load, so it just exits with error.

    Is there a way to load the subfolder albums while on page 2+?

    `
    while (next_album()) {
    ?>

    <?php
    }
    `
  • For sure there is a way, but you will have to become familiar with themeing for Zenphoto and specifically the zenphoto object model.

    Of course, there may well be sub-folders on page 2 depending on how your pagination is setup and how many sub-folders there are.

    There are functions such as isImagePage and isAlbumPage (the spelling of these may be wrong, this is from memory) that will tell you the context.
  • acrylian Administrator, Developer
    The easiest is to use either the printAlbumMenu actually.
  • @acrylian, printAlbumMenu looks like what I'm after, but a couple issues are present.

    1. It's only displaying photos from the first subfolder on the main album view. It's not showing the root level photos at all, even when the URL is the root.

    2. While in an album, the list is showing OTHER albums, is there a way to restrict it to show only the subfolders of the current album being viewed?

    Many thanks
  • acrylian Administrator, Developer
    Please review the plugin documentation about the available options.
  • I did, and that's why I'm getting those issues above. Sorry, should have included my code.

    `printAlbumMenu('list',null,null,null,null,null,null,null,null,true,null);`

    I want list, no count, no css (yet), no css (yet), no css (yet), no css (yet), no index name (default is fine), no first image link, keep top level album entry active, and no limit on truncation.

    No where do I see "list only menu options for the current album" nor "show only pictures in first sub".

    Please advise.
  • My #1 issue has gone away (great!),

    but my #2 issue still exists (seeing other albums when I don't want to). Only want to see the current subs.
  • acrylian Administrator, Developer
    $option:
    "list" for html list,
    "list-top" for only the top level albums,
    "omit-top" same as list, but the first level of albums is omitted
    "list-sub" lists the offspring level of subalbums for the current album
    "jump" dropdown menu of all albums(not context sensitive)
    http://www.zenphoto.org/documentation/plugins/_zp-extensions---print_album_menu.php.html#functionprintAlbumMenu

    The menu has nothing to do with ""show only pictures in first sub". It just lists the albums. All else you have to modify the theme.
  • Okay thanks. Yes, I was looking for something that will only show the subs of the currently viewed album.

    Since all other albums will be private and hidden from clients, I don't want that to be shown
  • If you have set up your user permissions to allow viewing of only their albums, then that is all that will show from these functions. You make the albums both private and unpublished.
  • The security is through obscurity. There is no index page. So "security" is performed by URL access. As a result, all users will be public guests.

    I'd rather not have public guests seeing albums they're not "supposed" to see. (if they stumble upon another album by luck (or because we've worked with them before), then I'm ok with it). Nothing confidential is being stored.

    It's just to cut down on confusion.

    If a visitor is viewing mysite.com/vendors/clientA, I don't want them to know about clientZ from clientA's album.

    They should only be able to see the subfolders within the URL they're viewing - in this example, it's clientA.

    It's not bulletproof security; because I don't need it to be. I just want to be able to silo the albums in an HTML subfolder list.
  • Best I can tell at this point, this custom function is working for me to display the subfolders for the album currently being viewed. It also works with infinite scroll. Thanks for the conversation.

    `
    function sidebarFolderMenu() {
    if (isAlbumPage()) {
    if (next_album())
    echo '

    Collections

    ';

    while (next_album()) {
    ?>

    <?php
    }
    }
    }
    `
  • Update rev2. The snippet above actually omits a folder. For example, if there are 5 subfolders, the code above will only show 4.

    This snippet seems to perform much better (and it's borrowed from the printAlbumMenu plugin).

    `
    function sidebarFolderMenu() {
    global $_zp_current_album;
    $albums = $_zp_current_album->getAlbums();
    if ($albums) { // If there are subfolders, lets do something with them
    echo '

    Collections

    ';
    echo '';
    } else { // No subfolders to display, add some text on screen.
    echo '

    Collections

    ';
    echo "No collections in this view.";
    }
    }
    `
  • acrylian Administrator, Developer
    Yes, as said above the next_album loop takes care of pagination.
Sign In or Register to comment.