= 4)
$output[] = $f;
}
return $output;
}
function generate_post_list($limit = -1, $page = 0) {
$events = scan_for_posts();
$output = "";
if ($limit == -1) {
foreach ($events as $event) {
$lines = file(__DIR__ . '/../posts/' . $event);
$title = $lines[0];
$desc = $lines[1];
$date = $lines[2];
$signatur = $lines[3];
$output .= '
';
}
} else {
$start_index = $page * $limit;
$end_index = $start_index + $limit;
if($end_index > count($events))
$end_index = count($events);
for ($i = $start_index; $i < $end_index; $i++) {
$lines = file(__DIR__ . '/../posts/' . $events[$i]);
$title = $lines[0];
$desc = $lines[1];
$date = $lines[2];
$signatur = $lines[3];
$output .= '';
}
}
return $output;
}
function get_post_content($id) {
$lines = file(__DIR__ . '/../posts/' . str_replace('.', '', $id) . '.md');
$output = "";
for ($i = 5; $i < count($lines); $i++)
$output .= $lines[$i] . "\n";
return $output;
}
?>