Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

How to depict schedules for a cinema site

Started by Muut Archive 10 years ago · 5 replies · 335 views
10 years ago

Hey Community!

I'm asking myself how to structure and depict schedules for movies (in YAML) for a cinema site!

Any thoughts? Advice? How to go about this?

10 years ago

just wondering how to layout a cinema site (YAML-file-structure) ...

10 years ago

I'd store them in yaml format, in a user/config/cinema.yaml file, and reference it from the Twig that lists the shows

10 years ago

This is movie.md
and it's header has the following information:

YAML
shows:
  - 2016-kw-12:
    thursday: ['15:15', '17:45', '20:30']
    friday: ['15:15', '17:45', '20:30']
    saturday: ['15:15', '17:45', '20:30']
    sunday: ['15:15', '17:45', '20:30']
    monday: ['15:15', '17:45', '20:30']
    tuesday: ['15:15', '17:45', '20:30']
    wednesday: ['15:15', '17:45']

I would like to pull out all the timestamps of this list in a separate Twig-file !

10 years ago
TWIG

{% set current_year = now|date("Y") %}
{% set current_week = now|date("W") %}

{% set path = current_year ~ '-kw-' ~ current_week %}

{% set all_shows = page.header.shows %}

{% for each_show in all_shows %}
  {% for thursdays_show in each_show.path.thursday %}
    {{ thursdays_show }}
  {% endfor %}
{% endfor %}

doesn't work.

10 years ago
TWIG
{% set movies = page.find('/movies/' ~ path).collection %}

helped me.

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1359 9 years ago
Archive · by Muut Archive, 9 years ago
2 936 9 years ago
Archive · by Muut Archive, 9 years ago
2 4066 9 years ago
Archive · by Muut Archive, 9 years ago
1 2957 9 years ago
Archive · by Muut Archive, 9 years ago
3 1121 9 years ago