index.php 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <?php
  2. if (isset($_GET['p'])) {
  3. $pageid = $_GET['p'];
  4. } else {
  5. $pageid = false;
  6. }
  7. if ($pageid && $pageid == "") {
  8. $pageid = false;
  9. }
  10. ?>
  11. <!DOCTYPE html>
  12. <!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
  13. <!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
  14. <!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
  15. <!--[if gt IE 8]> <html class="no-js"> <!<![endif]-->
  16. <html lang="de">
  17. <head>
  18. <meta charset="utf-8">
  19. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  20. <title>Hello World!</title>
  21. <meta name="description" content="">
  22. <meta name="viewport" content="width=device-width, initial-scale=1">
  23. <link rel="stylesheet" href="/style/style.min.css">
  24. <script src="/htmx/htmx.min.js"></script>
  25. </head>
  26. <body>
  27. <!--[if lt IE 7]><p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="#">upgrade your browser</a> to improve your experience.</p><![endif]-->
  28. <header>
  29. <nav hx-boost="true">
  30. <ul>
  31. <li>
  32. <a href="/?p=home" id="nav-link-home" hx-get="/content/home.php" hx-target="#main-content" hx-push-url="/?p=home" hx-on="click: navLinkClicked('home')" class="nav-link<?php if (!$pageid || $pageid == "home") {
  33. echo (" active");
  34. } ?>">Home</a>
  35. </li>
  36. <li>
  37. <a href="/?p=about" id="nav-link-about" hx-get="/content/about.php" hx-target="#main-content" hx-push-url="/?p=about" hx-on="click: navLinkClicked('about')" class="nav-link<?php if ($pageid == "about") {
  38. echo (" active");
  39. } ?>">About</a>
  40. </li>
  41. <li>
  42. <a href="/?p=contact" id="nav-link-contact" hx-get="/content/contact.php" hx-target="#main-content" hx-push-url="/?p=contact" hx-on="click: navLinkClicked('contact')" class="nav-link<?php if ($pageid == "contact") {
  43. echo (" active");
  44. } ?>">Contact</a>
  45. </li>
  46. </ul>
  47. </nav>
  48. </header>
  49. <main id="main-content" <?php if ($pageid && $pageid != 'home') {
  50. echo ("hx-get=\"/content/" . $pageid . ".php\" hx-trigger=\"load\"");
  51. } ?>>
  52. <section>
  53. <h1>Hello World!</h1>
  54. <button class="primary" hx-get="/get/?param=If you see this, it's working!" hx-trigger="click" hx-target="#replacebyget" hx-swap="innerHTML">Click Me!</button>
  55. <div id="replacebyget">
  56. <p>Response should appear here</p>
  57. </div>
  58. </section>
  59. <section>
  60. <h2>Content Rendered At:</h2>
  61. <div hx-get="/get/time.php" hx-trigger="load"></div>
  62. </section>
  63. </main>
  64. <footer>
  65. <div>
  66. <a href="/">Datenschutz</a>
  67. <p>&copy; 2023 Rose Reed</p>
  68. <a href="/">Impressum</a>
  69. </div>
  70. </footer>
  71. <script src="/script/site.js"></script>
  72. </body>
  73. </html>