Jump to content

Developer Documentation

Displaying comments in your application

EditorLocations extension

In order to display the editor field that enables users to leave comments, you will first need to create the EditorLocations extension for your application. For more information on doing this, consult the WYSIWYG Editor guide.

 

Displaying comments

It's up to you how comments are displayed in your application. Some applications will display comments in a traditional way, while others may require something much more custom. However you choose to display them, you need to include some standard attributes in your markup in order for functionality like live updating and pagination to work correctly. Here's a very basic approach:

<div data-controller='core.front.core.commentFeed' data-feedID='messages-{$item->id}'>
     {{if $item->commentPageCount() > 1}}
          {$item->pagination()|raw}
          <br><br><br>
     {{endif}}
     <div data-role='commentFeed'>
          {{if count( $item->comments() )}}
               {{foreach $item->comments() as $comment}}
                    {$comment->html()|raw}
               {{endforeach}}
          {{else}}
               <p data-role='noComments'>{lang="no_comments"}</p>
          {{endif}}
     </div>
     <div data-role='replyArea'>
          {$item->commentForm()|raw}
     </div>
</div>

Generic comment templates will be used to build the actual body of each comment. You can customize these via properties in your model; see the model guide for details.


  Report Document


×
×
  • Create New...