Knowledge Base Nr: 00184 array_pad.php3 - http://www.swe-kaiser.de

Downloads:

php: array_pad() ersatz für php3 (beispiel: liste formatieren)

  
<?
$arVCR = array();

$path = "P:/filme/videorecorder";
$dir = @opendir($path);
while ($file = readdir($dir))
{
if (is_file("$path/$file"))
{
$arVCR[] = "<li><a href=\"/kaiserreich/cgi-bin/nph-k_playMovie.pl?VCRfile=$path/$file\">$file</a>\n";
}
}

#erst ab php 4.0:
#$arVCR = array_pad($arVCR, $maxArray, "<br>\n");
#$arVideos = array_pad($arVideos, $maxArray, "<br>\n");
#$arMovies = array_pad($arMovies, $maxArray, "<br>\n");

while (count($arVCR) < $maxArray)
$arVCR[] = "<br>\n";
while (count($arVideos) < $maxArray)
$arVideos[] = "<br>\n";
while (count($arMovies) < $maxArray)
$arMovies[] = "<br>\n";
?>

<table width="90%">
<tr>
<th>TV Mitschnitte</th>
<th>Familienvideos</th>
<th>Übersicht der Filme:</th>
<tr>
<tr>
<td>
<ul type=square compact>
<?
for ($n=0; $n<count($arVCR); $n++)
print($arVCR[$n]);
?>
</ul>
</td>
<td>
<ul type=square compact>
<?
for ($n=0; $n<count($arVideos); $n++)
print($arVideos[$n]);
?>
</ul>
</td>
<td>
<ul type=square compact>
<?
for ($n=0; $n<count($arMovies); $n++)
print($arMovies[$n]);
?>
</ul>
</td>
</tr>
</table>