Systemtest_tk/subs/parts/blog.php

66 lines
2.3 KiB
PHP
Raw Permalink Normal View History

2019-08-08 13:35:16 +00:00
<?php
/**
* /subs/parts/blog.php
* @version 1.1
* @desc Blog page
* @author Fándly Gergő Zoltán (gergo@systemtest.tk, systemtest.tk)
* @copy 2018 Fándly Gergő Zoltán
* License:
Systemtest.tk website's.
Copyright (C) 2018 Fándly Gergő Zoltán
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
**/
?>
<span id="title" style="display: none"><?php echo (isset($titleExtend)?$titleExtend." :: ":"").($view==""?"":$lang[$view]." :: ").$lang['sitetitle'] ?></span>
<span id="langReadMore" style="display: none"><?php echo $lang['readmore'] ?></span>
<?php if($sub==""): ?>
<div id="keywords">
<h3><?php echo $lang['keywords'] ?></h3>
<?php
$sql=$db->prepare("SELECT DISTINCT tag, COUNT(tag) AS count FROM blog_tags GROUP BY tag ORDER BY count DESC");
$sql->execute();
while($row=$sql->fetch(PDO::FETCH_ASSOC)){
echo "<a href=\"/blog/tag:".$row['tag']."\" style=\"margin-right: 1em\">".$row['tag']." (".$row['count'].")</a>";
}
?>
</div>
<hr class="placeholder">
<div id="posts">
<!-- POSTS GO HERE -->
<script>
loadMorePosts();
</script>
</div>
<hr class="placeholder">
<button type="button" onclick="loadMorePosts()"><?php echo $lang['readmore'] ?></button>
<?php elseif(substr($sub, 0, 4)=="tag:"): ?>
<div id="posts">
<!-- posts that match a tag go here -->
<script>
loadTagPosts("<?php echo substr($_GET['sub'], 4) ?>");
</script>
</div>
<hr class="placeholder">
<button type="button" onclick="loadMorePosts()"><?php echo $lang['readmore'] ?></button>
<?php else: ?>
<div id="post">
<!-- Specific post goes here -->
<script>
loadPost("<?php echo $_GET['sub'] ?>");
</script>
</div>
<?php endif ?>