Part on Templates is finished
This commit is contained in:
parent
a45a77f0ae
commit
9e01258040
2 changed files with 46 additions and 47 deletions
26
index.php
26
index.php
|
|
@ -1,14 +1,4 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="style.css">
|
||||
<title>Demo</title>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
<?php
|
||||
$books = [
|
||||
[
|
||||
'name' => 'Do Androids Dream of Electric Sheep',
|
||||
|
|
@ -32,16 +22,4 @@
|
|||
$filteredItems = array_filter($books, function($book) {
|
||||
return $book['author'] == 'Andy Weir';
|
||||
});
|
||||
|
||||
?>
|
||||
<ul>
|
||||
<?php foreach($filteredItems as $book): ?>
|
||||
<li>
|
||||
<a href="<?= $book['purchaseUrl']; ?>">
|
||||
<?= $book['name']; ?> (<?= $book['releaseYear'] ?>)
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
require "index.view.php";
|
||||
21
index.view.php
Normal file
21
index.view.php
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="style.css">
|
||||
<title>Demo</title>
|
||||
</head>
|
||||
<body>
|
||||
<ul>
|
||||
<?php foreach($filteredItems as $book): ?>
|
||||
<li>
|
||||
<a href="<?= $book['purchaseUrl']; ?>">
|
||||
<?= $book['name']; ?> (<?= $book['releaseYear'] ?>)
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue