Data from Subpage in Snippet

Hello, i want to place the content of a separate page as a snippet on the homepage, but it doenst work as wanted.
Can anybody help me or tell me where the problem is?

Here my snippet:

<div class="event-wrapper">
    <div class="wrap">
    <?php if ($events): ?>
    <?php foreach($page->events()->yaml() as $event): ?>
        <div class="event">
          <?php echo $event['name'] ?>
          <?php echo $event['date'] ?>, <?php echo $event['time'] ?> – <?php echo $event['place'] ?>
        </div>
      <?php endforeach ?>
    <?php else : ?>
     <p>Aktuell sind leider keine Veranstaltungen eingetragen.</p>
    <?php endif ?>
    </div>
</div>

Sorry for my bad english :sweat_smile:

Where is that events page? Anyway, you can get another page than the current with the page() helper:

<?php
$events = page('events')->events()->toStructure();
if($events->count()) {
  foreach($events as $event):
  // some code
  endforeach;
}

BTW: If you have already defined $events, why don’t you use that variable when looping through the events?

Problem solved.

Thank you!