Esempio n. 1
0
function draw_comments_loop($comments, $is_parent)
{
    foreach ($comments as $comment) {
        if ($GLOBALS['comments_total'] == $GLOBALS['limit_count']) {
            break;
        }
        $GLOBALS['comments_total']++;
        echo '<div class="comment' . ($is_parent ? '' : ' child-comment') . '" style="padding-left: ' . 15 * ($is_parent ? 0 : 1) . 'px;">' . '<div class="unvoted comment-unvoted">' . '<div class="arrow comment-arrow up" onclick="upComment(' . (isset($_SESSION['user']) ? $_SESSION['user'] : 0) . ', ' . $comment['id'] . ');"></div>' . '<div class="arrow comment-arrow down" onclick="downComment(' . (isset($_SESSION['user']) ? $_SESSION['user'] : 0) . ', ' . $comment['id'] . ');"></div>' . '</div>' . '<div class="c-content" style="padding-bottom: 3px;">' . '<div class="tagline-comment">' . '<a class="author">' . $comment['username'] . '</a>' . ' <time>' . $comment['time'] . '</time> 前提交' . '</div>' . '<div class="content">';
        echo $comment['content'];
        echo '</div>' . '<div class="subtagline">';
        if (isset($_SESSION['user'])) {
            echo '<a href="javascript:void(0);" onclick="showReply(' . $comment['id'] . ');">回复</a>';
        }
        echo '</div>';
        echo '<div id="c-reply' . $comment['id'] . '" class="c-reply">' . '<div class="main-reply">' . '<textarea class="reply" id="reply' . $comment['id'] . '" cols="1" rows="1"></textarea>' . '</div>' . '<div>' . '<input class="btn-reply" type="submit" value="保存" onclick="subComment(' . $GLOBALS['subject']['id'] . ', ' . $comment['id'] . ');">' . ' <input class="btn-reply" type="button" value="取消" onclick="cancelReply(' . $comment['id'] . ');">' . '</div>' . '</div>' . '</div>';
        if (isset($comment['children'])) {
            draw_comments_loop($comment['children'], false);
        }
        echo '</div>';
    }
}
Esempio n. 2
0
function draw_comments_loop($comments, $is_parent)
{
    foreach ($comments as $comment) {
        echo '<div class="comment' . ($is_parent ? '' : ' child-comment') . '" style="margin-left: ' . 10 * ($is_parent ? 0 : 1) . 'px;">' . '<div class="unvoted comment-unvoted">' . '<div class="arrow comment-arrow up" onclick="up(' . $comment['id'] . ');"></div>' . '<div class="arrow comment-arrow down" onclick="down(' . $comment['id'] . ');"></div>' . '</div>' . '<div class="tagline-comment">' . '<a class="author">' . $comment['username'] . '</a>' . ' <time>' . $comment['time'] . '</time> 前提交' . '</div>' . '<div class="content">';
        echo $comment['content'];
        echo '</div>';
        if (isset($comment['children'])) {
            draw_comments_loop($comment['children'], false);
        }
        echo '</div>';
    }
}