Sourcefabric Manuals

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

Newscoop 4.4 Cookbook

List of issues and sections

List of Issues

Purpose:

Select the list of issues according to the given constraints and current environmental variables. The publication, language and issue variables may not be defined outside the list_issues statement; inside the statement however, all these variables are defined. The code between "{{ list_issues }}" statement and "{{ /list_issues }}" is repeated for every issue in the list.

Syntax:

{{ list_issues [length="<integer_value>"]
               [columns="<integer_value>"]
               [constraints="<list_of_issue_constraints>"]
               [order="<order_condition>"] }}
   <list_of_instructions>
{{ /list_issues }}

Filters:

  • 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.

<list_of_instructions> may contain any statement except: "set_language", "set_publication", "list_issues", "set_issue".

  • <list_of_issue_constraints>=
    • <issue_constraint> <list_of_issue_constraints>
    • <issue_constraint>
  • <issue_constraint>=
    • number<integer_operator> <integer_value>
    • name <string_operator> <string_value>
    • publish_date <date_operator> <date_value>
    • publish_year <integer_operator> <integer_value>
    • publish_month <integer_operator> <integer_value>
    • publish_mday <integer_operator> <integer_value>
    • <date_constraint>
  • <date_constraint>=
    • year <integer_operator> <integer_value>
    • mon_nr <integer_operator> <integer_value>
    • mday <integer_operator> <integer_value>
    • yday <integer_operator> <integer_value>
    • wday <integer_operator> <integer_value>
    • hour <integer_operator> <integer_value>
    • min <integer_operator> <integer_value>
    • sec <integer_operator> <integer_value>

where year stands for year, mon_nr for month number (1..12), mday for month day (1..31), yday for year day (1..365), wday for week day (1..7), hour for hour, min for minute and sec for second.

Any parameter used in <list_of_issue_constraints> can only be used once.

  • <order_condition>=
    • byNumber desc|asc
    • byName desc|asc
    • byDate desc|asc
    • byCreationDate desc|asc
    • byPublishDate desc|asc

Order conditions are self-explanatory; byDate and byCreationDate are aliases of byPublishDate.

Inside the List the following environment variables are modified:

  • language: if not defined before list start
  • publication: if not defined before list start
  • issue

The environment is restored after the list ends.

Examples:

Taken from Template Pack "The Custodian" (date 2011-03-16) file "archive.tpl"

{{ list_issues length="10" order="byNumber desc" }}
 <h2>
  <a href="{{ url options="template classic/archive.tpl" }}">
  {{ $gimme->issue->name }}</a>
 </h2>
  {{ if $gimme->language->name == "English" }}Issue
  {{ else }}Edicin{{ /if }}
   #{{ $gimme->issue->number }} /
  ({{ if $gimme->language->name == "English" }}published
  {{ else }}publicado{{ /if }}
 {{ $gimme->issue->publish_date|camp_date_format:'%M %D, %Y %h:%i:%s' }})
 {{ include file="skins/greenpiece/includes/pagination.tpl" }}
{{ /list_issues }}

Constraints:

Inside list_issues 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
  • unset_issue

list_issues statement can not be used inside any other list statements.

List of Sections

Purpose:

Select the list of sections according to the given constraints and current environmental variables. The publication, language, issue and section variables may not be defined outside the list_sections statement; inside the statement however, all these variables are defined. The code between "{{ list_sections }}" statement and "{{ /list_sections }}" is repeated for every section in the list.

Syntax:

{{ list_sections [length="<integer_value>"]
                 [columns="<integer_value>"]
                 [constraints="<list_of_section_constraints>"] }}
   <list_of_instructions>
{{ /list_sections }}

Filters:

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.

<list_of_instructions> may contain any statement except: "set_language", "set_publication", "list_issues", "set_issue", "list_section", "set_section".

  • <list_of_section_constraints>=
    • <section_constraint> <list_of_section_constraints>
    • <section_constraint>
  • <section_constraint>=
    • name <string_operator> <string_value>
    • number <integer_operator> <integer_value>

Any parameter used in <list_of_section_constraints> can only be used once.

Inside list_sections, the data context is defined by the constraints applied to the current section for every processed line. The data context is restored after the list processing.

Example:

Taken from the Template Pack "The Custodian" (date 2011-03-16) file "archive.tpl"

{{ list_sections order="bynumber asc" }}
 <h3>
  <a href="{{ uri }}" class="linksection-{{ $gimme->section->number }}">
  {{ $gimme->section->name }}</a>
  <!--{{ $gimme->section->number }}-->
 </h3>
 <ul>
  {{ list_articles }}
  <li id="list-article">
   <h4>
    <a href="{{ uri }}" class="linksection-{{ $gimme->section->number }}">
    {{ $gimme->article->name }}</a>
   </h4>
  <div class="list-article-published">
    {{ if $gimme->language->name == "English" }}posted
    {{ else }}publicado el
    {{ /if }}
   {{ $gimme->article->publish_date|camp_date_format:'%M %D, %Y %h:%i:%s' }}
  </div>
  {{ include file="classic/tpl/topic-list.tpl" }}
  </li>
  {{ /list_articles }}
 </ul>
{{ /list_sections }}

Constraints:

Inside list_sections 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
  • unset_issue
  • list_section
  • set_section
  • set_default_section
  • unset_section

The list_sections statement cannot be used inside list_articles, list_subtitles, or list_search_results statements.

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

You should refresh this page.