Hi,
I'm wanting to make my image page go to the next image when you click the image... then when at the last image in the sequence when you click it for it to go back to the first in the album? loop back round basically.
I've had a search and all I could find was this:
http://www.zenphoto.org/support/topic.php?id=2886#post-17289and this:
http://www.zenphoto.org/support/topic.php?id=1225#post-6896I've had a try and failed, I'm not the best at this stuff so totally lost as to the code I should put in??
Any help is greatly appreciated.
Thanks.
Comments
You might want to read the theming tutorial if you're having trouble with adding the code to your theme file. It gives explanations and insight into how themes in zenphoto work. http://www.zenphoto.org/2009/03/theming-tutorial/
I've tried putting the code in to my theme within the image.php page in the image div and no matter which version I choose or how I alter it I still can't get it working? I can get it working in the original way to see thickbox, or full size image, or no link at all, but just can't seem to get it to go to the next image then loop back!?
The first link above the guy seemed to have figured it out, but there is so many variations then slight confusion at the end as to whether it was solved in the end or not?
If anyone could help me out I would appreciate it. Almost reaching my final design :-)
Thanks again.
`
<?php }
if (hasNextImage()) { ?>
"><?php printCustomSizedImageMaxHeight(400); ?>
else { ?>
"><?php printCustomSizedImageMaxHeight(400); ?>
<?php } ?>
`
However, the code exactly how it is is still not completely correct; it needs to have the change posted by acrylian to work (`else { ?>` needs to be `<?php } else { ?>`).
There is also one other minor change that should be made - `printCustomSizedImageMaxHeight` is considered deprecated, so you should replace `printCustomSizedImageMaxHeight` with `printCustomSizedImageMaxSpace` (see http://www.zenphoto.org/documentation/functions/_template-functions.php.html#functionprintCustomSizedImageMaxHeight in the functions guide for details).
I've got:
`
<?php }
if (hasNextImage()) { ?>
"><?php printCustomSizedImageMaxSpace(640); ?>
<?php } else { ?>
"><?php printCustomSizedImageMaxSpace(640); ?>
<?php } ?>
`
and... it doesn't work? I'm sure it's an error someone who knows about php more than me will be able to spot instantly?
Returns: Parse error: syntax error, unexpected '}' in C:\Inetpub\vhosts\... etc
Thanks again.
My working code before was as follows:
`
<?php if(getOption("Use_thickbox")) {
$thickboxclass = " class=\"thickbox\"";
} else {
$thickboxclass = "";
}
?>
"<?php echo $thickboxclass; ?> title="<?php echo getBareImageTitle();?>">
<?php printCustomSizedImageMaxSpace(getBareImageTitle(),640,640); ?>
`
I basically want to get that code working with the click image to go to the next image and loop back round function?!
Hope that all sounds clear??
`
<?php }
if (hasNextImage()) { ?>
"><?php printCustomSizedImageMaxSpace(getBareImageTitle(),640,640); ?>
<?php } else { ?>
"><?php printCustomSizedImageMaxSpace(getBareImageTitle(),640,640); ?>
<?php ?>
`
That code seems to work but my comments only show up in the last picture of any album? other than that it all seems to work? well except for the fact I've not figured out how to incluce the image alt tag again yet... Light at the end of the tunnel though :-)
`
<?php
if (hasNextImage()) { ?>
"><?php printCustomSizedImageMaxSpace(getBareImageTitle(),640,640); ?>
<?php } else { ?>
"><?php printCustomSizedImageMaxSpace(getBareImageTitle(),640,640); ?>
<?php } ?>
`
--- themes/zenpage/image.php.bak 2012-01-12 05:58:03.810204278 +0100
+++ themes/zenpage/image.php 2012-01-14 01:15:57.890243727 +0100
<div id="image">
<?php if(getOption("Use_thickbox") && !isImageVideo()) {
$boxclass = " class=\"thickbox\"";
- $tburl = getUnprotectedImageURL();
+ $tburl = getNextImageURL();
} else {
$boxclass = "";
$tburl = getFullImageURL();