Re: Create a matrix gallery

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

 



> What I want to to do is insert a new <td> after showing 5 thumb images, and
> continue with the next picture on the next row.
> something like this
> __________________________
> |pic1 | pic2 | pic3 | pic4 | pic5 |
> __________________________
> |pic6 | pic7 | pic8 | pic9 | pic10 |
> __________________________
> |pic11 | pic12 | pic13 |
> __________________

You need to use the math function: modulo.

$MaxRows = 5;
for(.......){
  $m = fmod($ImageNumber, $MaxRows);
  if($m == 0){ echo "<tr>"; }
  echo "<td>";
  // [...] content of cell here
  echo "</td>";
  if($m == ($MaxRows-1)){ echo "</tr>"; }
}

Have fun!
Simon

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[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