Member
Member
MuschPusch   2008-03-04, 16:01
#1

Hi,

i want to check in a loop of album.php of the default template what the title of the next image is. This is because sometimes i have front and back pictures of one item (i mention front/back in the title).

This is the loop and i tried a couple of things but i always failed to find a proper solution.

[code]

while (next_image(false, $firstPageImages)):
$desc= getImageDesc();
// hide big pictures when not logged in...
if (zp_loggedin()){
$output.= "\n";
}else{
$output.= "\n";
}
$output.= "";
$last_image=getImageThumb(getImageTitle());
endwhile;

[/code]

regards Volkan

Member
Member
sbillard   2008-03-04, 17:50
#2

A simpler way of doing this is to add the information you want to print in the custom_data field of the image. Then you can just display it.

$custom = $_zp_current_image->getCustomData(); will return what you put in that field in ADMIN.

Member
Member
MuschPusch   2008-03-05, 13:11
#3

Hi sbillard,

thanks i will use the custom data field but i want to display the front and back images next to each other. Thats why i need to know if the next image is the back of an item so that i can output different html.

it must be something like this but i don't know how to access information of the next image.

[code]
`

//next image

if ($_zp_NEXT_image->getCustomData()=='back'){

// don't close the div

echo "n";

}elseif ($_zp_current_image->getCustomData()==back){

//close the div containing two images

echo "";

}else{

//standard one image div having no back image

echo "n";

}

`
[/code]

If you know an easier solution i would be gratefull to hear it...

regards Volkan

Administrator
Administrator
acrylian   2008-03-05, 13:40
#4

If you name your images, the file names, properly, you could use getNextImageURL() to extract the filename and check on that.

Developer
Developer
trisweb   2008-03-05, 20:27
#5

To get the next image is easy, it's built in to the image class:

`$nextimage = $_zp_current_image->getNextImage()

if ($nextimage->getCustomData()=='back') {

...`

Member
Member
MuschPusch   2008-03-15, 21:59
#6

If someone has similar problem. This was the solution:

`

while (next_image(false, $firstPageImages)):

                $desc= getImageDesc();

                $output.= "";

                $output.= "description:

".$desc."
n";

                // hide big pictures when not logged in...

                if (zp_loggedin()){

                    $output.= "n";

                }else{

                    $output.= "n";

                }

        if (strpos(getNextImageURL(),"back")!=''){

        next_image(false, $firstPageImages);

                    if (zp_loggedin()){

            $output.="";

        }else{

            $output.="";

        }

                }

                $output.= "";

                $last_image=getImageThumb(getImageTitle());

            endwhile;

`

gr volkan

  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.