Beispiel #1
0
function posts2send($mysqlPostsResult)
{
    $postsArray = [];
    while ($mysqlPostRow = mysqli_fetch_array($mysqlPostsResult)) {
        $postAssocArray = mysql2AssocArray($mysqlPostRow);
        if ($postAssocArray['parentPostId'] == 0) {
            $postsArray[] = array('id' => $postAssocArray['id'], 'parentPostId' => $postAssocArray['parentPostId'], 'postHTML' => parentPost2HTML($postAssocArray['id'], post2HTML($postAssocArray), ""));
        } else {
            $postsArray[] = array('id' => $postAssocArray['id'], 'parentPostId' => $postAssocArray['parentPostId'], 'postHTML' => post2HTML($postAssocArray));
        }
    }
    return $postsArray;
}
Beispiel #2
0
    <source src="files/sounds/smb_jump.mp3" type="audio/mpeg">
    <source src="files/sounds/smb_jump.wav" type="audio/wav">
</audio>

<div class="row" id="posts-container">
    <?php 
// Loop and print out each forum post
while ($postResult = mysqli_fetch_array($posts, MYSQL_ASSOC)) {
    // Turns the sql array into a properly formated post array
    $post = mysql2AssocArray($postResult);
    $postHtml = post2HTML($post);
    // Get all the replies for this post
    $repliesHtml = '';
    $postReplies = mysqli_query($db, "SELECT * FROM forum_posts WHERE parent_id='" . $post['id'] . "' AND forum='{$forumId}' ");
    while ($reply = mysqli_fetch_array($postReplies)) {
        $repliesHtml .= post2HTML(mysql2AssocArray($reply));
    }
    // Print a forum post and all its replies
    echo parentPost2HTML($post['id'], $postHtml, $repliesHtml);
}
?>
</div> <!-- .row #posts-container -->

<hr>

<?php 
$all_posts = mysqli_query($db, "SELECT * FROM forum_posts WHERE `forum` = '{$forumId}' AND `parent_id` = 0");
$num_posts = mysqli_num_rows($all_posts);
$num_pages = ceil($num_posts / $forumDetails['posts_per_page']);
$paginationHtml = '';
for ($i = 1; $i < $num_pages + 1; $i++) {