PHP Array question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have an array with image names like:

 

$arrayone = array("1.jpg", "2.jpg");

$arraytwo = array("a.jpg", "b.jpg");

 

 

Then I have a variable for each to count the number of elements:

 

$arrayoneElements = count($arrayone);

$arraytwoElements = count($arraytwo);

 

 

I'm using the element variables to control the loop to display all the array
elements.

 

This is it:

 

for($ctr=1; $ctr < $elemcount; $ctr++){

   if($ctr%5){

      echo "<td width=\"20%\"><a
href=\"javascript:popup_pic('".$gallerypath."/$arr[$ctr]')\"><img
src=\"".$gallerypath."thumbs/$arr[$ctr]\" alt=\"no image\" /></a></td>";

   }else{

      echo "<td width=\"20%\"><a
href=\"javascript:popup_pic('".$gallerypath."/$arr[$ctr]')\"><img
src=\"".$gallerypath."thumbs/$arr[$ctr]\" alt=\"no image\"
/></a></td></tr>\n<tr>";

   }

}

 

 

What I want to do is to only show 20 pictures at a time with a "Next" link
and a "Previous" link. For the first 20 only the "Next" link would show and
whenever the last set would show only the "Previous" link would. Every other
time both would show.

 

Can someone point me in the right direction on how to count through the
elements until the end and back to display them? I just can't figure it out.

 

Thanks,

-Roy

 


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux