WebWork Magazin - Webseiten erstellen lassen, Online Medien, html

Webhoster, Webhosting Provider und Domain registrieren

Home | Registrieren | Einloggen | Suchen | Aktuelles | GSL-Webservice | Suleitec Webhosting
Reparatur-Forum | Elektro forum | Ersatzteilshop Haushalt und Elektronik


Homepage und Webhosting-Forum

Scripte und Programme für PHP, MYSQL. Diskussionen zur Programmierung im Web. Fragen zu CMS, Blogsoftware, Shops, Newsletter und vielen weiteren Scripten.


Forum » PHP & MySQL » Neue Zeile nach x Feldern » Antworten
Benutzername:
Passwort: Passwort vergessen?
Inhalt der Nachricht: Fett | Kursiv | Unterstrichen | Link | Bild | Smiley | Zitat | Zentriert | Quellcode| Kleiner Text
Optionen: Emailbenachrichtigung bei Antworten
 

Die letzten 5 Postings in diesem Thema » Alle anzeigen
von Diamo
Hab meine ganzes Script mal umgeschrieben und jetzt funktionierts:
http://www.styleworker.de/V4
1: 
2: 
3: 
4: 
5: 
6: 
7: 
8: 
9: 
10: 
11: 
12: 
13: 
14: 
15: 
16: 
17: 
18: 
19: 
20: 
21: 
22: 
23: 
24: 
25: 
26: 
27: 
28: 
29: 
30: 
31: 
32: 
33: 
34: 
35: 
36: 
37: 
38: 
39: 
40: 
41:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

	<head>
		<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
		<title>Online Portfolio of Willy R.</title>
		<link href="style.css" rel="stylesheet" media="screen">
		<script language="JavaScript" src="fade.js"></script>
	</head>

	<body style="background-attachment: fixed;" background="images/index_06.jpg" >

<table width="100%" border="0" cellspacing="10" cellpadding="0">
	<tr>
<?php 
$verzeichnis = opendir("links/");
$y = 0;
while($datei = readdir ($verzeichnis)) {
 $y=$y+1;
 $take = str_replace(".gif", $replace, $datei);

 	if($datei != "." && $datei != "..") {
 	 echo "<td><a href=http://www.$take target=_blank>"
     	 ."<img src='links/$datei' border=0 width=88 height=31 style='filter:alpha(opacity=50)' onmouseover='nereidFade(this,100,30,5)' onmouseout='nereidFade(this,60,50,5)'></td>";
 	} else {
                $y = $y-1;
           }

 	if ($y % 4 == "0") {
  	 echo"</tr><tr>";
	}
}
closedir($verzeichnis);
?>
	</tr>
</table>

	</body>

</html>
von Diamo
Hi zusammen,

hab mir ein Script gecodet, dass Bilder aus einem Ordner ausliest und diese dann in einer Tabelle ausgibt, die nach 4 Bildern eine neue Zeile erstellt. Die Anzahl der Bilder im Ordner ermitteln geht ja noch, aber komischerweise funktioniert die Ausgabe nicht. Er ignoriert irgendwie die "while-anweisung" in der "for-schleife". Weiß vielleicht einer warum ?

Wenn ihr euch das script mal anschauen wollt: http://www.styleworker.de/V4/links.php

1: 
2: 
3: 
4: 
5: 
6: 
7: 
8: 
9: 
10: 
11: 
12: 
13: 
14: 
15: 
16: 
17: 
18: 
19: 
20: 
21: 
22: 
23: 
24: 
25: 
26: 
27: 
28: 
29: 
30: 
31: 
32: 
33: 
34: 
35: 
36: 
37: 
38: 
39: 
40: 
41: 
42: 
43: 
44: 
45: 
46:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

	<head>
		<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
		<title>Online Portfolio of Willy R.</title>
		<link href="style.css" rel="stylesheet" media="screen">
		<script language="JavaScript" src="fade.js"></script>
	</head>

	<body style="background-attachment: fixed;" background="images/index_06.jpg" >

<table width="100%" border="0" cellspacing="10" cellpadding="0">
	<tr>
<?php 
$counter=0;
$path = "links/";

$handle=opendir($path); 
while ($file = readdir ($handle)) 
{ 
    if (is_file($path.$file) && $file != "." && $file != "..") 
   {   $counter++;  } 
}

for ($i=0; $i < $counter; $i++) 
{   
		$y=$y+1;
		$replace = "";
		while ($file = readdir ($handle)) {
			$take = str_replace(".gif", $replace, $file);
			echo "<td><a href=http://www.$take target=_blank>\n"
			."    <img src='$path$file' border=0 width=88 height=31 style='filter:alpha(opacity=50)' onmouseover='nereidFade(this,100,30,5)' onmouseout='nereidFade(this,60,50,5)'></a>\n";
			}
            	echo "</td>\n";
        	if ($y % 4 == "0") echo "</tr><tr>";
}
closedir($handle);
?>
	</tr>
</table>

	</body>

</html>

Nach oben