public static function getCommentsForCommentID($id) { if (is_int($id) || is_string($id)) { $comment = new Comment($id); } else { $comment = $id; } $builder = ""; $user = new CustomUser($comment->PostedBy); $fullname = ucwords($user->getFullName()); $subCommentBuilder = ""; $comments = Comment::find(new Equals('InReplyTo', $comment->UniqueIdentifier)); foreach ($comments as $c) { $subCommentBuilder .= self::getCommentsForCommentID($c->CommentID); } $com = nl2br($comment->Comment); $builder .= <<<HTML <div class="comment-outer"> <div class="comment-background-underlay"></div> <div class="comment-outer-image"> <img src="{$user->Image}"> </div> <div class="comment-outer-text"> <div class="comment-outer-title"> <span class="comment-inner-name">{$fullname}</span><span class="comment-inner-date">{$comment->PostedAt}</span> </div> <div class="delete"> X </div> <div class="comment-inner-text">{$com}</div> <a href="#" comId="{$comment->UniqueIdentifier}" class="comment-reply">Atbildēt</a> </div> <div class="__clear-floats"></div> {$subCommentBuilder} </div> <div class="__clear-floats"></div> HTML; return $builder; }