Initiale Version
9
Kapitel_3/Lektion_2/1_funktionen.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
function sageHallo()
|
||||
{
|
||||
echo 'Hallo';
|
||||
echo ' Welt!';
|
||||
}
|
||||
|
||||
sageHallo();
|
||||
8
Kapitel_3/Lektion_2/2_parameter.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
function sageHallo($name)
|
||||
{
|
||||
echo 'Hallo ' . $name;
|
||||
}
|
||||
|
||||
sageHallo('PHP-Videotraining');
|
||||
9
Kapitel_3/Lektion_2/3_mehrere_parameter.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
function sageHallo($vorname, $nachname)
|
||||
{
|
||||
echo 'Hallo ' . $vorname . ' ' . $nachname;
|
||||
}
|
||||
|
||||
sageHallo('Barbara', 'Beispiel');
|
||||
sageHallo('Max', 'Muster');
|
||||
11
Kapitel_3/Lektion_2/4_sichtbarkeit.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
$a = 1;
|
||||
|
||||
function sageHallo($wert)
|
||||
{
|
||||
var_dump($a);
|
||||
var_dump($wert);
|
||||
}
|
||||
|
||||
sageHallo($a);
|
||||
6
Kapitel_3/Lektion_3/1_substr.php
Normal file
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
$einText = 'PHP 7 und MySQL';
|
||||
$ergebnis = substr($einText, 6, 3);
|
||||
|
||||
var_dump($ergebnis);
|
||||
7
Kapitel_3/Lektion_3/2_date.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
$ergebnis = date('Y');
|
||||
var_dump($ergebnis);
|
||||
|
||||
$ergebnis = date('d.m.Y H:i:s');
|
||||
var_dump($ergebnis);
|
||||
32
Kapitel_3/Lektion_3/3_mathe.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
$meineListe = [2, 3, 1];
|
||||
$ergebnis = max($meineListe);
|
||||
var_dump($ergebnis);
|
||||
|
||||
$meineListe = [2, 3, 1];
|
||||
$ergebnis = min($meineListe);
|
||||
var_dump($ergebnis);
|
||||
|
||||
|
||||
|
||||
$ergebnis = round(1.51);
|
||||
var_dump($ergebnis);
|
||||
|
||||
$ergebnis = round(1.51, 1);
|
||||
var_dump($ergebnis);
|
||||
|
||||
$ergebnis = floor(1.51);
|
||||
var_dump($ergebnis);
|
||||
|
||||
$ergebnis = ceil(1.51);
|
||||
var_dump($ergebnis);
|
||||
|
||||
|
||||
|
||||
$ergebnis = mt_rand();
|
||||
var_dump($ergebnis);
|
||||
|
||||
$ergebnis = mt_rand(5, 10);
|
||||
var_dump($ergebnis);
|
||||
|
||||
12
Kapitel_3/Lektion_7/1_fakultaet.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
function fakultaet($x)
|
||||
{
|
||||
if (0 == $x) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return $x * fakultaet($x - 1);
|
||||
}
|
||||
|
||||
echo fakultaet(3);
|
||||
16
Kapitel_3/Lektion_8/fotogalerie/foto.php
Executable 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>
|
||||
BIN
Kapitel_3/Lektion_8/fotogalerie/fotos/1.jpg
Executable file
|
After Width: | Height: | Size: 118 KiB |
BIN
Kapitel_3/Lektion_8/fotogalerie/fotos/2.jpg
Executable file
|
After Width: | Height: | Size: 128 KiB |
BIN
Kapitel_3/Lektion_8/fotogalerie/fotos/3.jpg
Executable file
|
After Width: | Height: | Size: 99 KiB |
BIN
Kapitel_3/Lektion_8/fotogalerie/fotos/4.jpg
Executable file
|
After Width: | Height: | Size: 108 KiB |
BIN
Kapitel_3/Lektion_8/fotogalerie/fotos/5.jpg
Executable file
|
After Width: | Height: | Size: 95 KiB |
BIN
Kapitel_3/Lektion_8/fotogalerie/fotos/6.jpg
Executable file
|
After Width: | Height: | Size: 96 KiB |
BIN
Kapitel_3/Lektion_8/fotogalerie/fotos/7.jpg
Executable file
|
After Width: | Height: | Size: 96 KiB |
BIN
Kapitel_3/Lektion_8/fotogalerie/fotos/8.jpg
Executable file
|
After Width: | Height: | Size: 97 KiB |
BIN
Kapitel_3/Lektion_8/fotogalerie/fotos/9.jpg
Executable file
|
After Width: | Height: | Size: 135 KiB |
83
Kapitel_3/Lektion_8/fotogalerie/index.php
Executable file
@@ -0,0 +1,83 @@
|
||||
<?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'
|
||||
]
|
||||
];
|
||||
|
||||
?>
|
||||
<!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>1 von 1 Fotos</p>
|
||||
<div>
|
||||
<div class="miniatur" style="float: left;">
|
||||
<a href="fotos/1.jpg">
|
||||
<img src="miniaturen/1.jpg" alt="1.jpg">
|
||||
</a>
|
||||
</div>
|
||||
Dateiname: 1.jpg<br>
|
||||
Tags: Industrie
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<div>
|
||||
<form action="index.php" method="post">
|
||||
<label for="suchbegriff">Suchbegriff:</label>
|
||||
<input type="text" id="suchbegriff" name="suchbegriff" value=""/>
|
||||
<button type="submit">Anwenden</button>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
BIN
Kapitel_3/Lektion_8/fotogalerie/miniaturen/1.jpg
Executable file
|
After Width: | Height: | Size: 11 KiB |
BIN
Kapitel_3/Lektion_8/fotogalerie/miniaturen/2.jpg
Executable file
|
After Width: | Height: | Size: 12 KiB |
BIN
Kapitel_3/Lektion_8/fotogalerie/miniaturen/3.jpg
Executable file
|
After Width: | Height: | Size: 11 KiB |
BIN
Kapitel_3/Lektion_8/fotogalerie/miniaturen/4.jpg
Executable file
|
After Width: | Height: | Size: 12 KiB |
BIN
Kapitel_3/Lektion_8/fotogalerie/miniaturen/5.jpg
Executable file
|
After Width: | Height: | Size: 11 KiB |
BIN
Kapitel_3/Lektion_8/fotogalerie/miniaturen/6.jpg
Executable file
|
After Width: | Height: | Size: 12 KiB |
BIN
Kapitel_3/Lektion_8/fotogalerie/miniaturen/7.jpg
Executable file
|
After Width: | Height: | Size: 11 KiB |
BIN
Kapitel_3/Lektion_8/fotogalerie/miniaturen/8.jpg
Executable file
|
After Width: | Height: | Size: 12 KiB |
BIN
Kapitel_3/Lektion_8/fotogalerie/miniaturen/9.jpg
Executable file
|
After Width: | Height: | Size: 18 KiB |
16
Kapitel_3/Lektion_8/fotogalerie_loesung/foto.php
Executable 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>
|
||||
BIN
Kapitel_3/Lektion_8/fotogalerie_loesung/fotos/1.jpg
Executable file
|
After Width: | Height: | Size: 118 KiB |
BIN
Kapitel_3/Lektion_8/fotogalerie_loesung/fotos/2.jpg
Executable file
|
After Width: | Height: | Size: 128 KiB |
BIN
Kapitel_3/Lektion_8/fotogalerie_loesung/fotos/3.jpg
Executable file
|
After Width: | Height: | Size: 99 KiB |
BIN
Kapitel_3/Lektion_8/fotogalerie_loesung/fotos/4.jpg
Executable file
|
After Width: | Height: | Size: 108 KiB |
BIN
Kapitel_3/Lektion_8/fotogalerie_loesung/fotos/5.jpg
Executable file
|
After Width: | Height: | Size: 95 KiB |
BIN
Kapitel_3/Lektion_8/fotogalerie_loesung/fotos/6.jpg
Executable file
|
After Width: | Height: | Size: 96 KiB |
BIN
Kapitel_3/Lektion_8/fotogalerie_loesung/fotos/7.jpg
Executable file
|
After Width: | Height: | Size: 96 KiB |
BIN
Kapitel_3/Lektion_8/fotogalerie_loesung/fotos/8.jpg
Executable file
|
After Width: | Height: | Size: 97 KiB |
BIN
Kapitel_3/Lektion_8/fotogalerie_loesung/fotos/9.jpg
Executable file
|
After Width: | Height: | Size: 135 KiB |
85
Kapitel_3/Lektion_8/fotogalerie_loesung/index.php
Executable file
@@ -0,0 +1,85 @@
|
||||
<?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'
|
||||
]
|
||||
];
|
||||
|
||||
?>
|
||||
<!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>1 von 1 Fotos</p>
|
||||
<?php foreach ($fotos 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=""/>
|
||||
<button type="submit">Anwenden</button>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
BIN
Kapitel_3/Lektion_8/fotogalerie_loesung/miniaturen/1.jpg
Executable file
|
After Width: | Height: | Size: 11 KiB |
BIN
Kapitel_3/Lektion_8/fotogalerie_loesung/miniaturen/2.jpg
Executable file
|
After Width: | Height: | Size: 12 KiB |
BIN
Kapitel_3/Lektion_8/fotogalerie_loesung/miniaturen/3.jpg
Executable file
|
After Width: | Height: | Size: 11 KiB |
BIN
Kapitel_3/Lektion_8/fotogalerie_loesung/miniaturen/4.jpg
Executable file
|
After Width: | Height: | Size: 12 KiB |
BIN
Kapitel_3/Lektion_8/fotogalerie_loesung/miniaturen/5.jpg
Executable file
|
After Width: | Height: | Size: 11 KiB |
BIN
Kapitel_3/Lektion_8/fotogalerie_loesung/miniaturen/6.jpg
Executable file
|
After Width: | Height: | Size: 12 KiB |
BIN
Kapitel_3/Lektion_8/fotogalerie_loesung/miniaturen/7.jpg
Executable file
|
After Width: | Height: | Size: 11 KiB |
BIN
Kapitel_3/Lektion_8/fotogalerie_loesung/miniaturen/8.jpg
Executable file
|
After Width: | Height: | Size: 12 KiB |
BIN
Kapitel_3/Lektion_8/fotogalerie_loesung/miniaturen/9.jpg
Executable file
|
After Width: | Height: | Size: 18 KiB |
16
Kapitel_3/Lektion_9/fotogalerie/foto.php
Executable 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>
|
||||
BIN
Kapitel_3/Lektion_9/fotogalerie/fotos/1.jpg
Executable file
|
After Width: | Height: | Size: 118 KiB |
BIN
Kapitel_3/Lektion_9/fotogalerie/fotos/2.jpg
Executable file
|
After Width: | Height: | Size: 128 KiB |
BIN
Kapitel_3/Lektion_9/fotogalerie/fotos/3.jpg
Executable file
|
After Width: | Height: | Size: 99 KiB |
BIN
Kapitel_3/Lektion_9/fotogalerie/fotos/4.jpg
Executable file
|
After Width: | Height: | Size: 108 KiB |
BIN
Kapitel_3/Lektion_9/fotogalerie/fotos/5.jpg
Executable file
|
After Width: | Height: | Size: 95 KiB |
BIN
Kapitel_3/Lektion_9/fotogalerie/fotos/6.jpg
Executable file
|
After Width: | Height: | Size: 96 KiB |
BIN
Kapitel_3/Lektion_9/fotogalerie/fotos/7.jpg
Executable file
|
After Width: | Height: | Size: 96 KiB |
BIN
Kapitel_3/Lektion_9/fotogalerie/fotos/8.jpg
Executable file
|
After Width: | Height: | Size: 97 KiB |
BIN
Kapitel_3/Lektion_9/fotogalerie/fotos/9.jpg
Executable file
|
After Width: | Height: | Size: 135 KiB |
85
Kapitel_3/Lektion_9/fotogalerie/index.php
Executable file
@@ -0,0 +1,85 @@
|
||||
<?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'
|
||||
]
|
||||
];
|
||||
|
||||
?>
|
||||
<!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>1 von 1 Fotos</p>
|
||||
<?php foreach ($fotos 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=""/>
|
||||
<button type="submit">Anwenden</button>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
BIN
Kapitel_3/Lektion_9/fotogalerie/miniaturen/1.jpg
Executable file
|
After Width: | Height: | Size: 11 KiB |
BIN
Kapitel_3/Lektion_9/fotogalerie/miniaturen/2.jpg
Executable file
|
After Width: | Height: | Size: 12 KiB |
BIN
Kapitel_3/Lektion_9/fotogalerie/miniaturen/3.jpg
Executable file
|
After Width: | Height: | Size: 11 KiB |
BIN
Kapitel_3/Lektion_9/fotogalerie/miniaturen/4.jpg
Executable file
|
After Width: | Height: | Size: 12 KiB |
BIN
Kapitel_3/Lektion_9/fotogalerie/miniaturen/5.jpg
Executable file
|
After Width: | Height: | Size: 11 KiB |
BIN
Kapitel_3/Lektion_9/fotogalerie/miniaturen/6.jpg
Executable file
|
After Width: | Height: | Size: 12 KiB |
BIN
Kapitel_3/Lektion_9/fotogalerie/miniaturen/7.jpg
Executable file
|
After Width: | Height: | Size: 11 KiB |
BIN
Kapitel_3/Lektion_9/fotogalerie/miniaturen/8.jpg
Executable file
|
After Width: | Height: | Size: 12 KiB |
BIN
Kapitel_3/Lektion_9/fotogalerie/miniaturen/9.jpg
Executable file
|
After Width: | Height: | Size: 18 KiB |
21
Kapitel_3/Lektion_9/fotogalerie_loesung/foto.php
Executable 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>
|
||||
BIN
Kapitel_3/Lektion_9/fotogalerie_loesung/fotos/1.jpg
Executable file
|
After Width: | Height: | Size: 118 KiB |
BIN
Kapitel_3/Lektion_9/fotogalerie_loesung/fotos/2.jpg
Executable file
|
After Width: | Height: | Size: 128 KiB |
BIN
Kapitel_3/Lektion_9/fotogalerie_loesung/fotos/3.jpg
Executable file
|
After Width: | Height: | Size: 99 KiB |
BIN
Kapitel_3/Lektion_9/fotogalerie_loesung/fotos/4.jpg
Executable file
|
After Width: | Height: | Size: 108 KiB |
BIN
Kapitel_3/Lektion_9/fotogalerie_loesung/fotos/5.jpg
Executable file
|
After Width: | Height: | Size: 95 KiB |
BIN
Kapitel_3/Lektion_9/fotogalerie_loesung/fotos/6.jpg
Executable file
|
After Width: | Height: | Size: 96 KiB |
BIN
Kapitel_3/Lektion_9/fotogalerie_loesung/fotos/7.jpg
Executable file
|
After Width: | Height: | Size: 96 KiB |
BIN
Kapitel_3/Lektion_9/fotogalerie_loesung/fotos/8.jpg
Executable file
|
After Width: | Height: | Size: 97 KiB |
BIN
Kapitel_3/Lektion_9/fotogalerie_loesung/fotos/9.jpg
Executable file
|
After Width: | Height: | Size: 135 KiB |
105
Kapitel_3/Lektion_9/fotogalerie_loesung/index.php
Executable 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>
|
||||
BIN
Kapitel_3/Lektion_9/fotogalerie_loesung/miniaturen/1.jpg
Executable file
|
After Width: | Height: | Size: 11 KiB |
BIN
Kapitel_3/Lektion_9/fotogalerie_loesung/miniaturen/2.jpg
Executable file
|
After Width: | Height: | Size: 12 KiB |
BIN
Kapitel_3/Lektion_9/fotogalerie_loesung/miniaturen/3.jpg
Executable file
|
After Width: | Height: | Size: 11 KiB |
BIN
Kapitel_3/Lektion_9/fotogalerie_loesung/miniaturen/4.jpg
Executable file
|
After Width: | Height: | Size: 12 KiB |
BIN
Kapitel_3/Lektion_9/fotogalerie_loesung/miniaturen/5.jpg
Executable file
|
After Width: | Height: | Size: 11 KiB |
BIN
Kapitel_3/Lektion_9/fotogalerie_loesung/miniaturen/6.jpg
Executable file
|
After Width: | Height: | Size: 12 KiB |
BIN
Kapitel_3/Lektion_9/fotogalerie_loesung/miniaturen/7.jpg
Executable file
|
After Width: | Height: | Size: 11 KiB |
BIN
Kapitel_3/Lektion_9/fotogalerie_loesung/miniaturen/8.jpg
Executable file
|
After Width: | Height: | Size: 12 KiB |
BIN
Kapitel_3/Lektion_9/fotogalerie_loesung/miniaturen/9.jpg
Executable file
|
After Width: | Height: | Size: 18 KiB |