sync, implemented sort, viewing user pages & articles written, updating db
This commit is contained in:
+39
-3
@@ -6,14 +6,50 @@ include_once 'components/head.php';
|
||||
|
||||
include_once 'functions/article_functions.php';
|
||||
|
||||
// TODO: Move to a grid, where the left hand column is either a search and filtering system, or...Table of Contents?
|
||||
|
||||
// Default view, it'll show articles by recency
|
||||
if (!isset($_GET['article_id']) && !isset($_GET['tag']) && !isset($_GET['author_id'])) {
|
||||
$ids = article_ids_by_recency();
|
||||
$filters = '
|
||||
<form method="get">
|
||||
<div class="row no_margin">
|
||||
';
|
||||
|
||||
if (!isset($_GET['sort']) || $_GET['sort'] == 'newest') {
|
||||
$ids = article_ids_by_newest();
|
||||
$filters .= '
|
||||
<p>Newest - Oldest</p>
|
||||
<label for="recency_desc"><i class="nf nf-md-sort_clock_descending_outline"></i>
|
||||
<input id="recency_desc" type="radio" name="sort" value="oldest" onclick="this.form.submit()">
|
||||
</label>
|
||||
';
|
||||
} else if ($_GET['sort'] == 'oldest') {
|
||||
$ids = article_ids_by_oldest();
|
||||
$filters .= '
|
||||
<p>Oldest - Newest</p>
|
||||
<label for="recency_asc"><i class="nf nf-md-sort_clock_ascending_outline"></i>
|
||||
<input id="recency_asc" type="radio" name="sort" value="newest" onclick="this.form.submit()">
|
||||
</label>
|
||||
';
|
||||
}
|
||||
|
||||
$filters .= '
|
||||
</div>
|
||||
</form>
|
||||
';
|
||||
|
||||
|
||||
echo '
|
||||
<div class="article_cards_grid">
|
||||
<div class="article_filters">
|
||||
' . $filters . '
|
||||
</div>
|
||||
<div class="article_cards">
|
||||
';
|
||||
foreach ($ids as $id)
|
||||
echo article_card($id);
|
||||
echo '
|
||||
</div>
|
||||
</div>
|
||||
';
|
||||
} else if (isset($_GET['article_id'])) {
|
||||
increment_read_counter($_GET['article_id']);
|
||||
echo article_page_from_markdown($_GET['article_id']);
|
||||
|
||||
Reference in New Issue
Block a user