remove the git category
that's enough web dev for a few years
This commit is contained in:
parent
33a7bfdee5
commit
c47cfb0a27
3 changed files with 67 additions and 80 deletions
42
dynamic.php
Normal file
42
dynamic.php
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
function recent_blogs() {
|
||||
$path = "blog";
|
||||
$limit = isset($_GET['all_blog']) ? false : 5;
|
||||
|
||||
$files = scandir($path."/");
|
||||
$entries = [];
|
||||
$i = 0;
|
||||
|
||||
/* get all the files */
|
||||
foreach ($files as $file) {
|
||||
if (is_dir($path.'/'.$file) && $file[0] != ".") {
|
||||
$tags = get_meta_tags($path.'/'.$file.'/index.html');
|
||||
$entries[$i][0] = preg_replace("/\//", "", $tags["date"]);
|
||||
$entries[$i][1] = $file;
|
||||
$entries[$i][2] = $tags["date"];
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
/* reverse the list */
|
||||
rsort($entries);
|
||||
|
||||
/* print the blogs out */
|
||||
printf('<table id="bloglist">');
|
||||
$i = 0;
|
||||
for (; $i < count($entries); $i++) {
|
||||
if ($limit && $i > $limit - 1) {
|
||||
break;
|
||||
}
|
||||
$file = $entries[$i][1];
|
||||
$age = $entries[$i][2];
|
||||
printf('<tr><td><a href=/%s/%s>%s</a></td><td class="date">%s</td></tr>',
|
||||
$path, $file, str_replace("-", " ", $file),
|
||||
$age ? $age : "¯\_(ツ)_/¯");
|
||||
}
|
||||
printf('<tr><td><a href=%s>%s</a></td></tr>',
|
||||
isset($_GET['all_blog']) ? "/" : "/?all_blog",
|
||||
isset($_GET['all_blog']) ? "...less" : "more...");
|
||||
printf('</table>');
|
||||
}
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue