diff options
Diffstat (limited to 'views')
| -rw-r--r-- | views/home/card.php | 15 | ||||
| -rw-r--r-- | views/home/index.php | 33 |
2 files changed, 21 insertions, 27 deletions
diff --git a/views/home/card.php b/views/home/card.php new file mode 100644 index 0000000..de7d6a6 --- /dev/null +++ b/views/home/card.php @@ -0,0 +1,15 @@ +<section class="card" onclick="window.location.href = '<?= $goto ?>'"> + <section class="quickinfo"> + <a href="<?= $page->URL ?>"><?= $page->URL ?></a> + <span class="float-right"><?= $page->Date ?></span> + </section> + <section class="title"> + <img src="<?= '/archives/' . $page->FaviconPath ?>"></span> + <span><?= $page->Title ?></span> + </section> + <section> + <strong>Visits: <?= $page->Visits ?></strong> + <strong><!-- Archives count --></strong> + </section> +</section> + diff --git a/views/home/index.php b/views/home/index.php index e14e23a..036a79a 100644 --- a/views/home/index.php +++ b/views/home/index.php @@ -11,34 +11,13 @@ <h1>Most popular archives</h1> -<?php foreach(Database\Webpage::fromDBmostVisited(10) as $page): ?> - <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> - </section> - <section class="title"> - <img src="<?= '/archives/' . $page->FaviconPath ?>"></span> - <span><?= $page->Title ?></span> - </section> - <section> - <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; ?> +<?php + foreach(Database\Webpage::fromDBmostVisited(10) as $page) { + $goto = "/archive/?url=$page->URL"; + include __DIR__ . '/card.php'; + } +?> <h1>...</h1> <div class="card-blank-afterspace"></div> - -<script type="text/javascript"> - function goto_archive(uri) { - window.location.href = '/archive/?url=' + uri; - } -</script> |
