echo get_config_value("site", "title"); ?> | Posts</title> </head> <body> <div class="component-left"> <div class="container container-center"> <?php include $_SERVER["DOCUMENT_ROOT"] . "/../includes/content.sidebar_left.php"; ?> </div> </div> <div class="component-right"> <div class="container container-padded"> <?php $posts = get_paginated_posts($page); foreach ($posts as $post) { echo "<h3><a href='/posts/" . $post["id"] . "'>" . $post["title"] . "</a></h3>"; echo strlen($post["text"]) < 1000 ? $post["text"] : substr($post["text"], 0, 1000) . "... " . "<a href='/posts/" . $post["id"] . "'>Read More</a>"; echo "<hr/>"; echo "<span class='post-details'>Posted by " . $post["author"] . ", <span class='date'>" . $post["date"] . "</span></span>"; } ?> <div class="small center"> <a href="/posts?page=<?php echo $page - 1; ?> "><< Previous</a> | Page <?php echo $page; ?> of <?php
function get_homepage_posts() { global $_CONFIG; return get_paginated_posts(1, $_CONFIG["posts"]["homepage_posts"]); }
<td>Title</td> <td>Author</td> <td>Date</td> </tr></thead> <tbody> </tbody> </table> </div> </div> <script> var data = [ <?php // What a horrible piece of code this is. Yes, I'm writing JavaScript in PHP. $posts = array_reverse(get_paginated_posts($page, 1000000), true); foreach ($posts as $post) { echo "["; echo '"' . str_replace('"', "'", $post["id"]) . '",'; echo '"' . str_replace('"', "'", "<a href='/admin/posts/manage/" . $post["id"] . "'>" . $post["title"] . "</a>") . '",'; echo '"' . str_replace('"', "'", $post["author"]) . '",'; echo '"' . str_replace('"', "'", $post["date"]) . '",'; echo "],"; } ?> ]; </script> <?php include $_SERVER["DOCUMENT_ROOT"] . "/../includes/content.resources.php"; ?>