ZenphotoCMS Forum
paging custom functions - Printable Version

+- ZenphotoCMS Forum (https://forum.zenphoto.org)
+-- Forum: Support (https://forum.zenphoto.org/forum-1.html)
+--- Forum: General support (https://forum.zenphoto.org/forum-4.html)
+--- Thread: paging custom functions (/thread-3236.html)



paging custom functions - marcov - 2008-07-06

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:

" title="">←

         " title=""> →

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:

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

an then, where I want the paging:

         " title="">←  



         " title=""> →

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




paging custom functions - acrylian - 2008-07-06

hasPrevAlbum() is a class mathod, you have to call it $_zp_current_album->hasPrevAlbum()
Alternativly you could use functions from templage-functions.php:
http://www.zenphoto.org/documentation/zenphoto/_template-functions.php.html#functiongetPrevAlbum
http://www.zenphoto.org/documentation/zenphoto/_template-functions.php.html#functiongetNextAlbum




paging custom functions - marcov - 2008-07-06

Shoot, that should have been so obvious - it`s in the function definition!

Beginner errors. Still, it did not work. I`m giving up, for now.




paging custom functions - acrylian - 2008-07-06

$_zp_current_album, a global variable, is only available if there is a "current album". For example this is the case on album.php (the thumbnail view) or on image.php (single image view).




paging custom functions - marcov - 2008-07-07

I see, thats why it keeps failing for the index.php. Ill try it for the album.php.
Thanks for the info.




paging custom functions - acrylian - 2008-07-07

You might want to look at our functions guide, we have also functions like getNextPageURL and getNextPageURL you could use for that.




paging custom functions - marcov - 2008-07-07

Yes, I did check the functions guide, I need to study it some more.