Newscoop 3 Cookbook

List images

List of Images

Purpose:

Create a list of images. The list is built from the Media Archive independently, whether the images are related to articles or not. The code between the "{{ list_images }}" statement and "{{ /list_images }}" is repeated for every image in the list. Inside the list every image is represented by an image object, (see "Image").

Syntax:

{{ list_images [length="<integer_value>"]
               [columns="<integer_value>"]
               [<filter>="<filter_value>"]}}
    <list_of_instructions>
{{ /list_images }}

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.
  • order="<order_field> <direction>" where <direction> may be "asc" (ascending) or "desc" (descending) and the <order_field> can be one of:
    • default: order by image identifier
    • byDescription: order by the description field
    • byPhotographer: order by the photographer field
    • byDate: order by image date field
    • byLastUpdate: order by the time the image was updated
  • description="<value>": select images whose description matches exactly the given value
  • photographer="<value>": select images whose photographer matches exactly the given value
  • place="<value>": select images whose place matches exactly the given value
  • caption="<value>": select images whose caption matches exactly the given value
  • date="<value>": select images whose date matches exactly the given value
  • type="<value>": select images whose type matches exactly the given value; valid type values are: png, jpeg, gif etc.
  • description_like="<value>": select images whose description matches partially the given value
  • photographer_like="<value>": select images whose photographer matches partially the given value
  • place_like="<value>": select images whose place matches partially the given value
  • caption_like="<value>": select images whose caption matches partially the given value
  • start_date="<value>": select images whose date matches or is greater than the given value
  • end_date="<value>": select images whose date matches or is smaller than the given value
  • search="<value>": select images whose description, photographer, place and caption matches partially the given value
  • local="true" | "false": select only local images if true, remote images if false

Inside list_images 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_attachments

Inside the list, the current image is set to the current element of the list. The environment context is restored after the list processing.

Example:

{{ list_images photographer="John\ Doe" order="byLastUpdate" }}
    <img src="{{ $gimme->image->thumbnailurl }}" /><br />
    <p>{{ $gimme->image->description }}</p>
{{ /list_images }}