Kapitel 3 Lektion 9 gesplittet

This commit is contained in:
Jan Unger 2016-08-25 21:12:11 +02:00
parent a4afe1a11c
commit b040a642fa
42 changed files with 251 additions and 9 deletions

View File

@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Fotogalerie - Foto 1.jpg</title>
</head>
<body>
<h1>Foto 1.jpg</h1>
<p>
<img src="fotos/1.jpg" alt="1.jpg">
</p>
<p>
<a href="index.php">Zurück</a>
</p>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 KiB

View File

@ -0,0 +1,105 @@
<?php
$fotos = [
[
'dateiname' => '1.jpg',
'tags' => 'Industrie'
],
[
'dateiname' => '2.jpg',
'tags' => 'Gebäude'
],
[
'dateiname' => '3.jpg',
'tags' => 'Gebäude, Natur'
],
[
'dateiname' => '4.jpg',
'tags' => 'Industrie'
],
[
'dateiname' => '5.jpg',
'tags' => 'Natur'
],
[
'dateiname' => '6.jpg',
'tags' => 'Gebäude, Natur'
],
[
'dateiname' => '7.jpg',
'tags' => 'Natur'
],
[
'dateiname' => '8.jpg',
'tags' => 'Gebäude'
],
[
'dateiname' => '9.jpg',
'tags' => 'Industrie'
]
];
function filter($liste, $suchbegriff)
{
$ergebnis = [];
foreach ($liste as $listenEintrag) {
if (false !== stripos($listenEintrag['tags'], $suchbegriff)) {
$ergebnis[] = $listenEintrag;
}
}
return $ergebnis;
}
if (count($_POST) > 0) {
$suchbegriff = $_POST['suchbegriff'];
$fotosGefiltert = filter($fotos, $suchbegriff);
} else {
$suchbegriff = '';
$fotosGefiltert = $fotos;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Fotogalerie</title>
<style>
.miniatur {
float: left;
}
.miniatur img {
margin-right: 10px;
}
.clearfix {
clear: both;
}
</style>
</head>
<body>
<h1>Fotogalerie</h1>
<p><?= count($fotosGefiltert); ?> von <?= count($fotos); ?> Fotos</p>
<?php foreach ($fotosGefiltert as $foto) : ?>
<div>
<div class="miniatur" style="float: left;">
<a href="fotos/<?= htmlspecialchars($foto['dateiname']); ?>">
<img src="miniaturen/<?= htmlspecialchars($foto['dateiname']); ?>" alt="<?= htmlspecialchars($foto['dateiname']); ?>">
</a>
</div>
Dateiname: <?= htmlspecialchars($foto['dateiname']); ?><br>
Tags: <?= htmlspecialchars($foto['tags']); ?>
<div class="clearfix"></div>
</div>
<?php endforeach; ?>
<div>
<form action="index.php" method="post">
<label for="suchbegriff">Suchbegriff:</label>
<input type="text" id="suchbegriff" name="suchbegriff" value="<?= htmlspecialchars($suchbegriff); ?>"/>
<button type="submit">Anwenden</button>
</form>
</div>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -0,0 +1,21 @@
<?php
$dateiname = $_GET['dateiname'];
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Fotogalerie - Foto <?= htmlspecialchars($dateiname); ?></title>
</head>
<body>
<h1>Foto <?= htmlspecialchars($dateiname); ?></h1>
<p>
<img src="fotos/<?= htmlspecialchars($dateiname); ?>" alt="<?= htmlspecialchars($dateiname); ?>">
</p>
<p>
<a href="index.php">Zurück</a>
</p>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 KiB

View File

@ -0,0 +1,105 @@
<?php
$fotos = [
[
'dateiname' => '1.jpg',
'tags' => 'Industrie'
],
[
'dateiname' => '2.jpg',
'tags' => 'Gebäude'
],
[
'dateiname' => '3.jpg',
'tags' => 'Gebäude, Natur'
],
[
'dateiname' => '4.jpg',
'tags' => 'Industrie'
],
[
'dateiname' => '5.jpg',
'tags' => 'Natur'
],
[
'dateiname' => '6.jpg',
'tags' => 'Gebäude, Natur'
],
[
'dateiname' => '7.jpg',
'tags' => 'Natur'
],
[
'dateiname' => '8.jpg',
'tags' => 'Gebäude'
],
[
'dateiname' => '9.jpg',
'tags' => 'Industrie'
]
];
function filter($liste, $suchbegriff)
{
$ergebnis = [];
foreach ($liste as $listenEintrag) {
if (false !== stripos($listenEintrag['tags'], $suchbegriff)) {
$ergebnis[] = $listenEintrag;
}
}
return $ergebnis;
}
if (count($_POST) > 0) {
$suchbegriff = $_POST['suchbegriff'];
$fotosGefiltert = filter($fotos, $suchbegriff);
} else {
$suchbegriff = '';
$fotosGefiltert = $fotos;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Fotogalerie</title>
<style>
.miniatur {
float: left;
}
.miniatur img {
margin-right: 10px;
}
.clearfix {
clear: both;
}
</style>
</head>
<body>
<h1>Fotogalerie</h1>
<p><?= count($fotosGefiltert); ?> von <?= count($fotos); ?> Fotos</p>
<?php foreach ($fotosGefiltert as $foto) : ?>
<div>
<div class="miniatur" style="float: left;">
<a href="foto.php?dateiname=<?= htmlspecialchars($foto['dateiname']); ?>">
<img src="miniaturen/<?= htmlspecialchars($foto['dateiname']); ?>" alt="<?= htmlspecialchars($foto['dateiname']); ?>">
</a>
</div>
Dateiname: <?= htmlspecialchars($foto['dateiname']); ?><br>
Tags: <?= htmlspecialchars($foto['tags']); ?>
<div class="clearfix"></div>
</div>
<?php endforeach; ?>
<div>
<form action="index.php" method="post">
<label for="suchbegriff">Suchbegriff:</label>
<input type="text" id="suchbegriff" name="suchbegriff" value="<?= htmlspecialchars($suchbegriff); ?>"/>
<button type="submit">Anwenden</button>
</form>
</div>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -1,18 +1,13 @@
<?php
$dateiname = $_GET['dateiname'];
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Fotogalerie - Foto <?= htmlspecialchars($dateiname); ?></title>
<title>Fotogalerie - Foto 1.jpg</title>
</head>
<body>
<h1>Foto <?= htmlspecialchars($dateiname); ?></h1>
<h1>Foto 1.jpg</h1>
<p>
<img src="fotos/<?= htmlspecialchars($dateiname); ?>" alt="<?= htmlspecialchars($dateiname); ?>">
<img src="fotos/1.jpg" alt="1.jpg">
</p>
<p>
<a href="index.php">Zurück</a>

View File

@ -85,7 +85,7 @@ if (count($_POST) > 0) {
<?php foreach ($fotosGefiltert as $foto) : ?>
<div>
<div class="miniatur" style="float: left;">
<a href="foto.php?dateiname=<?= htmlspecialchars($foto['dateiname']); ?>">
<a href="fotos/<?= htmlspecialchars($foto['dateiname']); ?>">
<img src="miniaturen/<?= htmlspecialchars($foto['dateiname']); ?>" alt="<?= htmlspecialchars($foto['dateiname']); ?>">
</a>
</div>