Newscoop 4 Cookbook

List search results

List of Search Results

Purpose:

Create a list of articles that match the search keywords entered by the reader. The publication, language, issue, section, and article variables may not be defined outside the list_search_results statement; inside the statement however, all these variables are defined. The code between the "{{ list_search_result }}" statement and "{{ /list_search_result }}" is repeated for every article in the list.

Syntax:

{{ list_search_results [length="<integer_value>"]                        [columns="<integer_value>"]                        [order="<order_condition>"] }}    <list_of_instructions> {{ /list_search_result }} 

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", or "set_publication".

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

Order conditions are self-explanatory; byDate is an alias of byCreationDate. The default order of articles in the list (if no order condition was set) is: first they are ordered by the publication identifier ascending, then by the issue number descending, then by the section number ascending, and by the article order in the section ascending.

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

Constraints:

Inside list_articles 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