예제 #1
0
    <?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']];