Advertisement
UniQuet0p1

book add

Nov 17th, 2021
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. <?php
  2. $lines = file("Project/books.txt");
  3. $employees = [];
  4. foreach ($lines as $line) {
  5. list($id, $title, $grade) = explode(";", $line);
  6. $employees[] = ["id" => $id, "title" => $title, "grade" => $grade];
  7. }
  8. ?>
  9. <!doctype html>
  10. <html lang="en">
  11. <head>
  12. <meta charset="utf-8">
  13. <link rel="stylesheet" type="text/css" href="Project/styles.css">
  14. <title>Raamatud</title>
  15. </head>
  16. <body id="book-list-page">
  17.  
  18. <div id="root">
  19.  
  20. <nav>
  21. <div>
  22. <a href="index.php" id="book-list-link">Raamatud</a>
  23. <a href="Project/book-add.php" id="book-form-link">Lisa raamat</a>
  24. <a href="Project/author-list.php" id="author-list-link">Autorid</a>
  25. <a href="Project/author-add.php" id="author-form-link">Lisa autor</a>
  26. </div>
  27. </nav>
  28.  
  29. <main>
  30.  
  31. <div id="authors">
  32.  
  33. <div class="title header">Pealkiri</div>
  34. <div class="author header">Autorid</div>
  35. <div class="grade header">Hinne</div>
  36.  
  37. <div class="br header-divider"></div>
  38.  
  39.  
  40. <div>
  41. <?php foreach ($employees as $each): ?>
  42.  
  43. <?php print $each["title"] . PHP_EOL; ?>
  44.  
  45. <?php endforeach; ?>
  46. </div>
  47.  
  48. <div>
  49.  
  50. </div>
  51.  
  52. <div class="score">
  53. <?php foreach ($employees as $each): ?>
  54.  
  55. <?php print $each["grade"] . PHP_EOL; ?>
  56.  
  57. <?php endforeach; ?>
  58. </div>
  59.  
  60.  
  61. </div>
  62. </main>
  63.  
  64. <footer>
  65. ICD0007 Näidisrakendus
  66. </footer>
  67.  
  68. </div>
  69.  
  70. </body>
  71. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement