Forum Moderators: coopster
I am a graphic designer who does some programming but a lot of it is out of my realm. This is one of those cases. I have all the code written except for the last "for loop". Here is what I'm trying to do: I'm trying to use a text file to call images into a loop for displaying as gallery. the first item is the image name and the second is the description seperated by a ";"
Here is the contents of the text file:
Image1.gif;Image1 Description
Image2.gif;Image2 Description
Image3.gif;Image3 Description
Image4.gif;Image4 Description
Here is the php code i'm trying to use:
$pic_info = file("$path_to_project/$pic_info_file");
$number_pics = count ($pic_info);
if (($currentPic > $number_pics)¦¦($currentPic == $number_pics)¦¦!$currentPic)
$currentPic = '0';
}
$item = preg_split('/;/', rtrim($pic_info[$currentPic]), 2);
$image_title = isset($item[1]) ? $item[1] : '';
$images .= "$item[0]";
$first_image = "$item[0]";
echo('<a href="'. $first_image . '" rel=lightbox[' . $path_to_project .'] class="highlight" title="$image_title"><img src="'. $project_thumb_url . '" width="200" /></a>');
echo("<div style=\"display:none\">");
//this code needs to loop:
echo('<a href="'. /* the remaining file names need to loop here */ . '" rel="lightbox[' . $path_to_project. ']" title="'. /*description after the l needs to go here */ .'"></a>');
//end loop
echo("</div>");
for($i = $currentPic+1; $i < sizeof($pic_info); $i++){
$item = explode(";", $pic_info[$i]);
echo('<a href="'.$item[0]. '" rel="lightbox[' . $path_to_project. ']" title="'.$item[1].'"></a>');
}