@($topic = $_GET['topic']); @($news = $_GET['news']); $post_type = ""; $post_id = 0; $categories = array(); $categories = $posts->categories_array(); if (!$topic == "") { $post_type = "topics"; $post_id = $topic; } elseif (!$news == "") { $post_type = "news"; $post_id = $news; } $post_views = $posts->add_views($post_type, $post_id); // $sql=select($post_type, array("id")); $sql = $posts->view_post($post_type, array("id")); while ($rows_posts_id = mysqli_fetch_array($sql)) { $posts_id[] = $rows_posts_id['id']; } // $sql =select($post_type,array("id","name","date","views","body","writer"),array("id",$post_id)); $sql = $posts->view_post($post_type, array("id", "name", "date", "views", "body", "writer"), $post_id); while ($rows_posts = mysqli_fetch_array($sql)) { $post_id = $rows_posts['id']; $post_name = $rows_posts['name']; $post_writer = $rows_posts['writer']; $created = $rows_posts['date']; $post_body = htmlentities(nl2br($rows_posts['body'])); } //Add Comments if (isset($_POST['addreply'])) { if (!empty($_POST['addreply_name_edit']) && !empty($_POST['addreply_body_edit'])) {
<?php // $sql= select("news",array("id","name")); // while($rows= mysqli_fetch_array($sql)){ // $news[$rows['id']]=$rows['name']; // } // $categories=array(); // $sql= select("categories",array("id","name")); // while($rows= mysqli_fetch_array($sql)){ // $categories[$rows['id']]=$rows['name']; // } include_once '/model/posts.php'; $posts = new posts(); $categories = $posts->categories_array(); $sql = $posts->view_post("news", array("id", "name")); while ($news_array = mysqli_fetch_array($sql)) { $news[$news_array['id']] = $news_array['name']; } ?> <div id="topics"> <div id="sub"> <font color="black"><h2>Latest Topics</h2></font></div> <ul> <?php $sql = $posts->view_post("topics", false, false, array("date", "DESC"), 5); while ($rows_topics = mysqli_fetch_array($sql)) { $topic_id = $rows_topics['id']; $topic_name = $rows_topics['name']; $topic_body = nl2br(htmlentities($rows_topics['body'])); $topic_writer = $rows_topics['writer']; $topic_date = $rows_topics['date']; $topic_category = $categories[$rows_topics['category_id']];
<ul> <li><a href=''>First</a></li> <li><a href=''>Second</a></li> <li><a href=''>Third</a></li> <li><a href=''>Fourth</a></li> <li><a href=''>Fifth</a></li> </ul> </li> <li><a href=''>Fourth</a></li> <li><a href=''>Fifth</a></li> </ul> </div> <form action="?page=search" method="POST"> <div id="search"> <input type='text' id='txtbox' name='searchtxt' placeholder='Search ..........' /> <div> <select id="select" name="select"> <option value="categories" selected="selected">All Categories</option> <?php $sql = $posts->view_post('categories', array('id', 'name')); while ($rows_categories = mysqli_fetch_array($sql)) { echo "<option value=" . $rows_categories['id'] . ">" . $rows_categories['name'] . "</option>"; } ?> </select> </div> <input type="submit" value="" class="srchbtn" name="submit"> </div> </form> </div>