paging custom functions

In order to get around the problem described in the following post
http://www.zenphoto.org/support/topic.php?id=3383&replies=1#post-20275

my image.php uses the following paging code, instead of the printPageListWithNav function:

<?php if (hasPrevImage()) { ?> " title="<?php echo gettext('Prev Image'); ?>">← <?php echo gettext(""); ?>

<?php if (($num = getNumImages()) > 1) { echo imageNumber() . " of " . getNumImages() . " "; }?>

<?php } if (hasNextImage()) { ?> " title="<?php echo gettext('Next Image'); ?>"><?php echo gettext("");?> →<?php } ?>

The above code works as expected for my image page - the navigation links are not displayed if I am on the first or last page.

So, I tried to implement a similar scheme, using two custom functions I defined in a themefunctions.php file:

<?php

require_once(SERVERPATH . "/" . ZENFOLDER . "/template-functions.php");

function hasNextAlbum() { global $_zp_current_album; return $_zp_current_album->getNextAlbum(); }

function hasPrevAlbum() { global $_zp_current_album; return $_zp_current_album->getPrevAlbum(); }

?>

Next, in my index.php file I included the following:

<?php require ('themefunctions.php'); ?>

an then, where I want the paging:

<?php if (hasPrevAlbum()) { ?> " title="<?php echo gettext('Prev Album'); ?>">← <?php echo gettext(""); ?>

<?php if (($num = getNumAlbums()) > 1) { echo albumNumber() . " of " . getNumAlbums() . " "; }?>

<?php } if (hasNextAlbum()) { ?> " title="<?php echo gettext('Next Album'); ?>"><?php echo gettext("");?> →<?php } ?>

Now, I am not a PHP coder, so I need a bit of help trying to figure out how to fix the following errors:

Fatal error: Call to a member function getPrevAlbum() on a non-object in C:\wamp\www\zenphoto\themes\boxedblack\themefunctions.php on line 9

If I modify the themefunctions.php file to surround my functions with:

...
class themeFunctions {
... my custom functions go here
}

I get the following:

Fatal error: Call to undefined function hasPrevAlbum() in C:\wamp\www\zenphoto\themes\boxedblack\index.php on line 61

Comments

Sign In or Register to comment.