Kirby->render() without header and footer

Template where other page gets rendered

$data = ['includeSnippet' => false];
tpl::$data = array_merge(tpl::$data, array(
    'kirby' => kirby(),
    'site'  => site(),
    'pages' => site()->children(),
), page('homepage')->controller($data));

echo $kirby->render(page('somepage'), $data);

Somepage controller:

return function($site, $pages, $page, $args) {
  
  $includeSnippet = isset($args['includeSnippet'])?$args['includeSnippet']:true;
  // other controller stuff
  return compact('includeSnippet')

};

Somepage template:

<?php if($includeSnippet) snippet('header') ?>
<!-- main template code that should get rendered in the other page -->
<?php if($includeSnippet) snippet('footer') ?>
1 Like