Hasvisiblechildren... how to display the content of a subpage in a parent page

It’s a long time I have been here…

This seems to be very simple but I cannot get the thing to work:

I want to mix static and dynamic content on a page. It’s about actions and events. There are some general informations about events that I want to provide (like what kind of events and how to book them) and concrete events with all the content (images included), on top of the page:

I tried something like this:

    <?php if($page->hasVisibleChildren()) {
      $children = $p->children()->visible();
     ...
    }?>
    <?php endif ?>

Is there anybody who can give me a hint?

Two issues:

  • you use curly braces but endif, remove endif or the curly braces
  • $p is not defined, use $page

Turn on debugging to get error messages!

<?php if($page->hasVisibleChildren()):
$children = $page->children()->visible();
//…
?>
<?php endif ?>
<?php foreach($page->children()->visible() as $child): ?>
    <h2><?= $child->title()->html() ?></h2>
<?php endforeach ?>

Thanks to both of you. So simple…