-1

最近の投稿 (ブログ) を含むメイン ページを作成しようとしています。

最新の 2 つを別のディスプレイ [html & css] で使用し、他の 6 つをそれらとは異なるもので使用したいと考えています。この写真のように... http://i.imgur.com/T0imWxM.jpg

編集1

// Gets 2 recent posts [displayed in 2 big boxes]
    function get_important_posts() {
    global $dblink;
    mysqli_set_charset($dblink, 'utf8');
       // if () {
            $result = mysqli_query($dblink ,"SELECT * 
                                                                    FROM `posts` 
                                                                    ORDER BY `post_id` 
                                                                    DESC LIMIT 0,2") or die(mysqli_connect_error($dblink));
            $rowNumber = 0;
            while ($row = mysqli_fetch_array($result) ) {
                if ($rowNumber < 1) {
                    echo  '<div class="bigbox right">
                    <a href="post.php?id=' . $row['post_id'] .'">
                    <div class="bigboximg"><img src="'. $row['bigthumb'] .'" width="390" alt="' . $row['title'] .'"></div></a>
                    <a href="post.php?id=' . $row['post_id'] .'"><div class="bigboxtitle">' . $row['title'] . '</div></a>
                    <div class="bigboxexcerpt">'. $row['excerpt'] . '</div>
                    </div>';
                    $rowNumber++;
                } else {
                    echo  '<div class="bigbox left">
                    <a href="post.php?id=' . $row['post_id'] .'">
                    <div class="bigboximg"><img src="'. $row['bigthumb'] .'" width="390" alt="' . $row['title'] .'"></div></a>
                    <a href="post.php?id=' . $row['post_id'] .'">
                    <div class="bigboxtitle">' . $row['title'] . '</div></a>
                    <div class="bigboxexcerpt">'. $row['excerpt'] . '</div></div>';
                    $rowNumber++;
                    }

            }
    }
//}

    // Gets 5 recent posts after the 2 recent posts
    function get_posts() {
    global $dblink;
    mysqli_set_charset($dblink, 'utf8');
    $result = mysqli_query($dblink ,"SELECT * 
                                                             FROM `posts` 
                                                             ORDER BY `post_id` 
                                                             DESC LIMIT 2,5") or die(mysqli_connect_error($dblink));
    while ($row = mysqli_fetch_array($result) ) {
            echo  '<div class="box">
            <a href="post.php?id=' . $row['post_id'] .'">
            <div class="boximg"><img src="'. $row['smallthumb'] .'" width="130" alt="' . $row['title'] .'"></div></a>
            <a href="post.php?id=' . $row['post_id'] .'">
            <div class="boxtitle">' . $row['title'] . '</div></a>
            <div class="boxexcerpt">'. $row['excerpt'] . '</div></div>';            
       }
    }
4

2 に答える 2