OnePager $data access

Hi,

I am trying to create a onepager following the cookbook article
https://getkirby.com/docs/cookbook/one-pager
I created snippets for all the sections and it all works well until I want to hand over data to the snippets.

home.php

<?php
      snippet('header');
      foreach($pages->visible() as $section) {
       snippet($section->uid(), array('data' => $section));
      }
      snippet('footer');
    ?>

about.php in snippets folder

<section id="><?php echo $data->title()->html() ?>" class="overlay">
  <h1><?php echo $data->title()->html() ?></h1>
  <?php echo $data->text()->kirbytext() ?>
</section>

The section id is the pagetitle to create a navigation scrollTo link. The problem is, that I always get an error and I don´t see the reason since it is pretty much the same as in to the tutorial. I guess I am overlooking something

Undefined variable: data

Many thanks!

There’s a typo in the above code, i.e. the closing >after ìd=

<section id="<?php echo $data->title()->html() ?>" class="overlay">
  <h1><?php echo $data->title()->html() ?></h1>
  <?php echo $data->text()->kirbytext() ?>
</section>

Other than that, I don’t see why $data should be undefined. Is the error thrown in the about.php snippet?

Thanks, the typo happened while editing it here in the editor. But I still get the error with the corrected code. Yes it is thrown in the about snippet.

Again, where is the error thrown, which line which snippet?

Yes it is thrown in the about snippet.

And there is no typo where you pass the variable to the snippet, your code is exactly as above? So you are really passing data to the snippet, not something else?

Yes, double checked it several times now. May be the mistake is somewhere else. May be I just start over.

The startover helped and it works as expected… Don´t know what caused the error. Thanks anyway.