Problem with last image

Hi

I am having a weird issue, everything works fine except the last image of every album will not show but gets an error returned.

Fatal error: Call to a member function getTitle() on a non-object in /home/content/00/7926600/html/i-am-peter.com/themes/Square-One/image.php on line 27

Only happens with last image.

This is the code I use, and where I expect an issue.

<?php $nextimg = $_zp_current_image->getNextImage();$previmg = $_zp_current_image->getPrevImage(); ?>
<span class="link-orange">next image is</span>
<a class="" href="
<?php echo getNextImageURL();?>" title="
<?php echo gettext("Next Image"); ?>"><?php echo $nextimg->getTitle(); ?>

P.H.

Comments

  • acrylian Administrator, Developer
    You need to check if there is a next image. If there is not there is no object and this error is natural.

    There are theme functions for next/prev images (you normally don't need to use the oject methodes directly here) or you have check i $nextim is an object. Same applies of course for the previous image.
  • Hi Acrylian, thanks for the fast reply.

    this error also occurs when clicking on the last image in any of my albums.

    site is www.i-am-peter.com
  • acrylian Administrator, Developer
    Yes because you don't check if there is a next image. Please review the theming tutorial and the standard themes regarding the next/prev navigation.
  • Hi again Acrylian

    I could not find anything about the navigation in the user guides, but managed to get it working by re-copying the working code from skeleton theme and re-arranging things a bit.

    Thanks again for replying

    P.H.
  • acrylian Administrator, Developer
    The theming tutorial has examples of standard theme pages that exactly show the next/prev function usage. Of course zpSkeleton is a not a official theme and does a few things off the "standard".
Sign In or Register to comment.