

<input type="hidden" id="userId" name="userId" value="{$userId}">
{foreach $comments as $comment}
    <div class="media" id="comment{$comment->id}">
        <a href="javascript:;" class="pull-left blogpapa"></a>
        <div class="media-body">
            <h4 class="media-heading bold"> {$comment->memberName}
                <span class="replayrecomment">
                    <label  data-commentId="{$comment->id}" class="reply"> Reply </label>
                </span>
            </h4>
            <p>{$comment->comment}
                {if $userId == $comment->memberid}
                    <span class="replayrecomment">
                        <label  data-commentId="{$comment->id}" class="delete"> delete </label>
                    </span>
                {/if}
            </p>
            <hr>
            <div id="relatedComments{$comment->id}">
                {foreach $comment->childs as $relatedComment}  
                <!-- Nested media object -->
                   <div class="media" id="comment{$relatedComment->id}">
                       <a href="javascript:;" class="pull-left blogpapa"></a>
                       <div class="media-body">
                           <h4 class="media-heading bold">{$relatedComment->memberName}
                               {if $userId == $relatedComment->memberid}
                               <span class="replayrecomment">
                                    <label  data-commentId="{$relatedComment->id}" data-mastercommentId="{$comment->id}" class="delete"> delete </label>
                                </span>
                               {/if}
                           </h4>
                           <p>{$relatedComment->comment}</p>
                       </div>
                   </div>
                   <!--end media-->
                   <hr>
                {/foreach}
            </div>
            <div id="relatedComments_input{$comment->id}"></div>
        </div>
    </div>
{/foreach}

