예제 #1
0
파일: index.php 프로젝트: krystofurr/HC-CIS
/**
 *  Used to display all comments in the database.  This function is only to tidy up
 *  the source code.
 *
 */
function showAllComments()
{
    // Show comments if there is any present. '$comments' will be 2-D [int][assoc]
    $comments = GuestBook::getComments();
    if (is_array($comments)) {
        for ($i = 0; $i < count($comments); ++$i) {
            ?>
            <div class="commentBox">
                <p class="commentTitle text-center"><?php 
            echo $comments[$i]['comm_Title'];
            ?>
</p>
                <p><?php 
            echo $comments[$i]['comm_Body'];
            ?>
</p>
                <p>User Posted: <?php 
            echo $comments[$i]['user_Username'];
            ?>
</p>
                <p class="text-center">Date Posted: <?php 
            echo date("F j, Y, g:i a", $comments[$i]['comm_Date_Posted']);
            ?>
</p>
            </div>
            <?php 
        }
    } else {
        ?>
        <div>
            <p class="text-center commentBox"><?php 
        echo $comments;
        ?>
</p>
        </div>
        <?php 
    }
}