aboutsummaryrefslogtreecommitdiff
path: root/views/home
diff options
context:
space:
mode:
authorSyndamia <kamen@syndamia.com>2025-01-26 14:04:11 +0200
committerSyndamia <kamen@syndamia.com>2025-01-26 14:04:11 +0200
commitbfa238c056f31f36c00faad1c5995cbb8af3bd26 (patch)
treee35d6b33fff3e79ae905d7dad699134553a1292d /views/home
parentc36f74386bcbb19c13915fe3796cb757aa7d1845 (diff)
downloadnowayforward_human-bfa238c056f31f36c00faad1c5995cbb8af3bd26.tar
nowayforward_human-bfa238c056f31f36c00faad1c5995cbb8af3bd26.tar.gz
nowayforward_human-bfa238c056f31f36c00faad1c5995cbb8af3bd26.zip
feat!: Rework all views to be used with the router
Diffstat (limited to 'views/home')
-rw-r--r--views/home/index.php26
-rw-r--r--views/home/meta.php3
2 files changed, 16 insertions, 13 deletions
diff --git a/views/home/index.php b/views/home/index.php
index f567744..abc872b 100644
--- a/views/home/index.php
+++ b/views/home/index.php
@@ -1,12 +1,8 @@
-<?php
- $title = 'Home';
- include '../meta.php';
-?>
-
<section class="highlight separate-margin">
<h2>Explore the archives or add a new page</h2>
- <form action="/archive/index.php" method="GET" class="font-125 flex-row width-100 center-margin">
- <input type="text" name="page_url" placeholder="Enter a URL" class="flex-expand">
+
+ <form action="/archive" method="GET" class="font-125 flex-row width-100 center-margin">
+ <input type="text" name="url" placeholder="Enter a URL" class="flex-expand">
<input type="submit" value="Search">
</form>
</section>
@@ -16,7 +12,7 @@
<h1>Most popular archives</h1>
<?php foreach(Database\Webpage::mostVisited(10) as $page): ?>
- <section class="card" onclick="open_archive('<?= $page->URL ?>')">
+ <section class="card" onclick="goto_archive('<?= $page->URL ?>')">
<section class="quickinfo">
<a href="<?= $page->URL ?>"><?= $page->URL ?></a>
<span class="float-right"><?= $page->Date ?></span>
@@ -29,16 +25,20 @@
<strong>Visits: <?= $page->Visits ?></strong>
<strong><!-- Archives count --></strong>
</section>
+ <script type="text/javascript">
+ function open_archive(url) {
+ window.location.href = '/archive/' + url;
+ }
+ </script>
</section>
<?php endforeach; ?>
+
<h1>...</h1>
<div class="card-blank-afterspace"></div>
<script type="text/javascript">
-function open_archive(url) {
- window.location.href = '/archive/index.php?page_url=' + url;
-}
+ function goto_archive(uri) {
+ window.location.href = '/archive/?url=' + uri;
+ }
</script>
-
-<?php end_page(); ?>
diff --git a/views/home/meta.php b/views/home/meta.php
new file mode 100644
index 0000000..4d1a472
--- /dev/null
+++ b/views/home/meta.php
@@ -0,0 +1,3 @@
+<?php
+
+$title = "Home";