function printBlog($id = null) { global $db; global $postsperpage; global $pg; $first = ($pg - 1) * $postsperpage; //Which post to start with on the page $query = 'SELECT * FROM blog WHERE status="published" ORDER BY timestamp DESC LIMIT ' . $first . ', ' . $postsperpage; $posts = $db->dq($query); foreach ($posts as $post) { printArticle($post, true); } }
function viewArticle() { $articleid = $_REQUEST['articleid']; $article = getValidArticle($articleid); if (!$article) { h3("Fant ikke artikkelen."); } else { increment_view_count($articleid); table_open(); tr_open(); td_open(1); printArticle($article[0]); div_open("showarticlelink"); if (isset($_SESSION['valid_admin'])) { echo printAdminArticlesMenu($article[0]['articleid']); } else { if (isset($_SESSION['valid_user'])) { if ($_SESSION['valid_user'] == $article[0]['author_username']) { echo printAuthorArticlesMenu($article[0]['articleid']); } } } div_close(); td_close(); tr_close(); table_close(); makeAnchor("comments"); listComments($article[0]['articleid']); if (isset($_SESSION['valid_user'])) { makeAnchor("entercomment"); enterComment($article[0]['articleid']); } else { echo '<a href="javascript:viewLogin()">Logg inn for å legge inn kommentar</a>'; } } }
echo stripslashes($post['title']); ?> | Pixar Portal</title> <?php include 'nodes/head_tags.php'; ?> </head> <body class="page_blog"> <?php include 'nodes/header.php'; ?> <div id="frame" class="frame"> <section class="content"> <?php printArticle($post, false); ?> </section> <?php include 'nodes/sidebar.php'; ?> </div> <script src="/js/main.js"></script> </body> </html>