ok your example is next to useless to me since i don't actually have your images... so i can't know how much space is really there for each one....
please either change the code to make direct links to your images... or better yet put in a width and heigth for each image....
also browsers play bad bad games with spaceing all the time that has nothing to do with whitespace....
here is an example that should make evenly spaced columns every time.. but the browser will always screw it up by changing the internal spacings.... click on the three four and twelve things and you will see what i mean....
all of these comeout to 500 pixels wide.. but the browsers take liberty with how big each td is inside it...
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<?php
function euclidGCF( $a, $b )
{
if ( $a == $b ) {
return $a;
}
if ( $a==0 or $b==0 ) {
return 0;
}
if ( $a < $b ) {
$min = $a;
$max = $b;
} else {
$min = $b;
$max = $a;
}
$gcf = NULL;
$mod = $min;
do {
$gcf = $mod;
$mod = $max % $min;
$max = $min;
$min = $mod;
} while ( $mod > 0 );
return $gcf;
}
$dir = $_GET['dir'];
function menu( $submenu )
{
$menus = array(
"zero" => array(
"display" => "Menu Zero",
"link" => $_SERVER['PHP_SELF']."?dir=zero",
"sublinks" => array()
),
"one" => array(
"display" => "Menu One",
"link" => $_SERVER['PHP_SELF']."?dir=one",
"sublinks" => array(
"one-1" => $_SERVER['PHP_SELF'] )
),
"two" => array(
"display" => "Menu Two",
"link" => $_SERVER['PHP_SELF']."?dir=two",
"sublinks" => array(
"2-1" => $_SERVER['PHP_SELF'],
"2-2" => $_SERVER['PHP_SELF'] )
),
"three" => array(
"display" => "Menu Three",
"link" => $_SERVER['PHP_SELF']."?dir=three",
"sublinks" => array(
"3-1" => $_SERVER['PHP_SELF'],
"3-2" => $_SERVER['PHP_SELF'],
"3-3" => $_SERVER['PHP_SELF'] )
),
"four" => array(
"display" => "Menu Four",
"link" => $_SERVER['PHP_SELF']."?dir=four",
"sublinks" => array(
"4-1" => $_SERVER['PHP_SELF'],
"4-2" => $_SERVER['PHP_SELF'],
"4-3" => $_SERVER['PHP_SELF'],
"4-4" => $_SERVER['PHP_SELF'] )
),
"twelve" => array(
"display" => "Menu Twelve",
"link" => $_SERVER['PHP_SELF']."?dir=twelve",
"sublinks" => array(
"12-1" => $_SERVER['PHP_SELF'],
"12-2" => $_SERVER['PHP_SELF'],
"12-3" => $_SERVER['PHP_SELF'],
"12-4" => $_SERVER['PHP_SELF'],
"12-5" => $_SERVER['PHP_SELF'],
"12-6" => $_SERVER['PHP_SELF'],
"12-7" => $_SERVER['PHP_SELF'],
"12-8" => $_SERVER['PHP_SELF'],
"12-9" => $_SERVER['PHP_SELF'],
"12-10" => $_SERVER['PHP_SELF'],
"12-11" => $_SERVER['PHP_SELF'],
"12-23" => $_SERVER['PHP_SELF'] )
),
);
$count_menu = count($menus);
$count_sub = 1;
if ( isset($menus[$submenu]) ) {
$count_sub = count($menus[$submenu]['sublinks']);
}
if ( $count_sub == 0 ) {
$menu_span = 1;
$sub_span = 1;
} else {
$gcf = euclidGCF($count_menu,$count_sub);
$menu_span = ceil( $count_sub / $gcf );
$sub_span = ceil( $count_menu / $gcf );
}
if ( $count_menu > 0 ) {
echo "
<table border='0' cellpadding='0' cellspacing='0' width='500'>
<!-- main menu -->
<tr>
";
foreach ( $menus as $menu_name=>$menu ) {
print <<<END
<td colspan="{$menu_span}" align="center"><a href="{$menu['link']}">{$menu['display']}</a></td>
END;
}
echo "
</tr>
<!-- /main menu -->
";
if ( isset($menus[$submenu]) && count($menus[$submenu]['sublinks'])>0 ) {
echo "
<!-- sub menu -->
<tr>
";
foreach ( $menus[$submenu]['sublinks'] as $display=>$link ) {
print <<<END
<td colspan="$sub_span" align="center"><a href="{$link}">{$display}</a></td>
END;
} # foreach submenu link
echo "
</tr>
<!-- /sub menu -->
";
} # if submenu exists
echo "
</table>
";
} # if count_menu > 0
} # function menu
?>
<html>
<head>
<title>Sup</title>
</head>
<body>
<?php menu($dir) ?>
</body>
</html>