Beispiel #1
0
    echo mb_strtoupper('®Other_answers®', 'UTF-8');
    ?>
</label>
    </div>
    <div id="comments_list">
        <?php 
    if (is_array($thread['comments'])) {
        $thread_main_comments = get_main_comments($thread['comments']);
        $i = 0;
        foreach ($thread_main_comments as $comment) {
            if ($i != 0) {
                echo '<div class="eom"></div>';
            }
            require template_getpath('div_comment.php');
            $i++;
            $childs = get_comment_childs($thread['comments'], $comment);
            foreach ($childs as $comment) {
                ?>
                    <div  class="<?php 
                echo $comment['level'];
                ?>
">
                        <div class="eom"></div>
                        <?php 
                require template_getpath('div_comment.php');
                ?>
                    </div>
                    <?php 
            }
        }
    }
Beispiel #2
0
/**
 * Returns the childens of a comment
 * @param type $fullList
 * @param type $parent
 * @return array
 */
function get_comment_childs($fullList, $parent)
{
    $childs = array();
    foreach ($fullList as $child) {
        if ($child['parent'] == $parent['id']) {
            $child['level'] = 'level-1';
            $childs[] = $child;
            if ($child['nbChilds'] > 0) {
                $sub_childs = get_comment_childs($fullList, $child);
                foreach ($sub_childs as $value) {
                    $value['level'] = 'level-2';
                    $childs[] = $value;
                }
            }
        }
    }
    return $childs;
}