function CommentTree($comments, $depth = -1) { $depth++; foreach ($comments as $comment) { ?> <a href="#comment_collapse<?php echo $comment->id; ?> " class="list-group-item" style="padding-left:<?php echo 15 + $depth * 15; ?> px;"><?php echo $comment->content; ?> </a> <?php CommentTree($comment->comments, $depth); } }
function CommentTree($comments, $depth = -1) { $depth++; foreach ($comments as $comment) { ?> <div style="border: 1px dashed #d2d2d2; padding: 10px; margin-left:<?php echo 15 + $depth * 15; ?> px;"><?php echo $comment->content; ?> by <cite><?php echo $comment->author; ?> </cite><a data-view="data-reference" href="<?php echo SERVER_ROOT_URL . '/article/view/' . $_POST['post_id'] . '/' . $comment->id; ?> " class="float-right">✉</a></div><br /> <?php CommentTree($comment->comments, $depth); } }