Sourcefabric Manuals

 English |  Español |  Français |  Italiano |  Português |  Русский |  Shqip

Newscoop 4.3 Cookbook

List article comments

Purpose:

Create a list of comments attached to the article currently defined in the template environment. If the article was not defined the comments list is empty. The code between the "{{ list_article_comments }}" statement and "{{ /list_article_commnets }}" is repeated for every comment in the list.

Syntax:

{{ list_article_comments [ignore_language="true|false"]
                         [ignore_article="true|false"]
                         [length="<integer_value>"]
                         [columns="<integer_value>"]
                         [order="<order_condition>"] }}
   <list_of_instructions>
{{ /list_article_comments }}

Filters:

  • ignore_language: list comments regardless of the comment language
  • ignore_article: list comments for all articles, not only for the current article
  • length="<integer_value>": <integer_value> specifies list_length and forces the list to have at most list_length items. If the list contains more items than list_length items the interval of elements to be displayed can be switched using has_previous_elements and has_next_elements from the current_list object.
  • columns="<integer_value>": <integer_value> specifies columns_number and sets an environment variable. This is incremented as if the items were placed in a table cell. The counting starts from one and the variable is incremented for every new element. When it reaches the maximum value it is reset to one. This is very useful in building tables of data. For details see current_list.

Note on ignore_article: this option will force the list order to date ordering. ignore_language and ignore_article only work in Newscoop 3.2.2 and newer.

  • <order_condition>=
    • byDate desc|asc
    • default desc|asc

The default order of the comments in the list (if no order condition was specified) is based on the tree structure of the comments as in the following example:

  • root comment 1
    • reply 1 (parent is root comment 1)
      • reply 1_1 (parent is reply 1)
  • root comment 2
  • ...

The first element in the list is the first comment that was submitted, second is it's first reply (if it exists), first reply of the first reply .. and so on down the tree structure, until it finds no other reply, second reply to the root element etc.

If the order by date condition was specified the comments are displayed strictly by their submission date, regardless of the relation they had to the other comments.

Example:

{{ list_article_comments order="byDate desc" }}
    Subject: {{ $gimme->comment->subject }}<br/>
    Posted {{ $gimme->comment->submit_date }}
    by <b>{{ $gimme->comment->reader_email }}</b>
    <br/>
    {{ $gimme->comment->content }}
    <br/>
{{ /list_article_comments }}

The following example is taken from the theme "The Custodian" (2011-03-16) file comments.tpl

{{ list_article_comments }}
{{ if $gimme->current_list->at_beginning }}
 <a name="commentlist">
  <h4>
  {{ if $gimme->language->name == "English" }}Previous comments
  {{ else }}Los comentarios anteriores
  {{ /if }}
  </h4>
 </a>
{{ /if }}
 <div class="comment" {{ if $gimme->current_list->at_end }}
  id="everlast"{{ /if }}>
   <p><strong>{{ $gimme->comment->nickname }}</strong><br>
   {{ $gimme->comment->content }}</p>
    <p>
     <em>
      {{ $gimme->comment->subject }} |
      <span>{{ $gimme->comment->submit_date|camp_date_format:"%M
      %e, %Y" }}</span>
     </em>
    </p>
 </div>
<!-- /.comment -->
{{ /list_article_comments }}

Inside list_article_comments the following statements are forbidden:

  • set_language
  • set_default_language
  • unset_language
  • set_publication
  • set_default_publication
  • unset_publication
  • list_issues
  • set_issue
  • set_default_issue
  • set_current_issue
  • unset_issue
  • list_sections
  • set_section
  • set_default_section
  • unset_section
  • list_articles
  • set_article
  • set_default_article
  • unset_article
  • list_article_comments

There has been error in communication with Booktype server. Not sure right now where is the problem.

You should refresh this page.