Insert reusable field in template

Hello,

I need a timetable with two information sections a) bus stops an b) departure times.
In the panel I want to add diffrent bus stops and the departure times for each bus stop.

How can I insert this in my template? (The bus stops should display as accordion)

#/site/bluprints/pages/about.yml
columns:
  width: 1/1       
    fields:
      fahrplan:
        label: Fahrplan
        type: structure
        fields:
          haltestellen:
            label: Haltestellen
            type: text
          zeiten:
            extends: sections/zeiten
            label: Zeiten

Reusable zeiten field

label: Zeiten
type: structure
fields:
  zeit:
    label: Zeit
    type: time
    step: 1

The template looks like that

<?php foreach ($page->fahrplan()->toStructure() as $fahrplan): ?>       
  <button class="accordion">
    <?= $fahrplan->haltestellen() ?></button>       
      <div class="panel">
        <ul>
          <?php foreach ($page->zeiten()->toStructure() as $zeit): ?>
            <li>
              <?= $zeit() ?>
            </li>
          <?php endforeach ?>
        </ul>       
      </div>
  <?php endforeach ?>

Thanks for your help.

Not $page->zeiten() but $fahrplan->zeiten() because the second structure is inside the first. Then inside the second structure, call the field again by it’s field name:

<?php foreach ($fahrplan->zeiten()->toStructure() as $zeit): ?>
  <li>
    <?= $zeit->zeit() ?>
  </li>
<?php endforeach ?>

Thx for the fast feedback.

For <?= $zeit()->zeit() ?> i get an error:

"Function name must be a string"

$zeit->zeit()

:see_no_evil:

Wow your the best!:+1: