# Panel, "Undefined variable: page"

**URL:** <https://forum.getkirby.com/t/panel-undefined-variable-page/19761>\
**Category:** Questions\
**Tags:** v3\
**Created:** [October 15, 2020, 6:00pm UTC](https://forum.getkirby.com/t/panel-undefined-variable-page/19761 "2020-10-15T18:00:08Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![DennisAndersson](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/dennisandersson/32/8319_2.png) [@DennisAndersson](https://forum.getkirby.com/u/DennisAndersson)\
**Post date:** [October 15, 2020, 6:00pm UTC](https://forum.getkirby.com/t/panel-undefined-variable-page/19761/1 "2020-10-15T18:00:08Z")

</div>

I’m probably missing something pretty basic here, but I’m kind of lost at what I should be looking for. Obviously, the `page` variable is undefined but where is it actually used in this blueprint (`site.yml`)?

```auto
title: Site
columns:
  - width: 1/3
    sections:
      fields:
        maintitle:
          label: Header main title
          type: text
          required: true
          width: 1/2
        subtitle:
          label: Header tagline
          type: text
          required: true
          width: 1/2
        menu:
          type: structure
          fields:
            label:
              label: Item label
              type: text
              help: If not set, the linked page title will be used
              width: 1/2
            url:
              type: pages
              label: Internal URL
              max: 1
              width: 1/2 
        introduction:
          label: Index introduction text
          type: textarea
          buttons: false
          required: true
  - width: 1/3
    sections:
      pages:
        type: pages
        templates:
          - about
          - home
          - default
          - experience
          - notes
  - width: 1/3
    fields:
      socials:
        label: Social networks
        type: structure
        fields:
          label:
            label: Label
            type: text
          url:
            label: URL
            type: url

```

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [October 15, 2020, 6:50pm UTC](https://forum.getkirby.com/t/panel-undefined-variable-page/19761/2 "2020-10-15T18:50:46Z")

</div>

I don’t know what’s causing the error, but there’s something wrong with your template: The fields sections is missing the fields key:

```auto
    sections:
      fields:
        fields:
          maintitle:
            label: Header main title
            type: text
            required: true
            width: 1/2
          subtitle:
            label: Header tagline
            type: text
            required: true
            width: 1/2

```

Apart from that, maybe there is an error in a template?

---

<div class="post-metadata">

**Author:** ![DennisAndersson](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/dennisandersson/32/8319_2.png) [@DennisAndersson](https://forum.getkirby.com/u/DennisAndersson)\
**Post date:** [October 15, 2020, 7:10pm UTC](https://forum.getkirby.com/t/panel-undefined-variable-page/19761/3 "2020-10-15T19:10:39Z")

</div>

No dice unfortunately. I even tried going back to basics and skip the columns all together:

```auto
title: Some text
fields:
    ....

```

It’s fully possible that there is an error in a template somewhere but I can’t see anything obvious, not errors are being shown with the `debug` flag active. Is there any way of getting a more thorough error in the panel? I can’t see anything particular in my localhost error logs either.

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [October 15, 2020, 7:48pm UTC](https://forum.getkirby.com/t/panel-undefined-variable-page/19761/4 "2020-10-15T19:48:59Z")

</div>

Is there anything in the browser console maybe?

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [October 15, 2020, 8:46pm UTC](https://forum.getkirby.com/t/panel-undefined-variable-page/19761/5 "2020-10-15T20:46:40Z")

</div>

See also here same error cause by an undefined variable in a snippet: [Info field throws error: Undefined variable: page](https://forum.getkirby.com/t/info-field-throws-error-undefined-variable-page/16142/15)

---

<div class="post-metadata">

**Author:** ![DennisAndersson](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/dennisandersson/32/8319_2.png) [@DennisAndersson](https://forum.getkirby.com/u/DennisAndersson)\
**Post date:** [October 16, 2020, 4:01pm UTC](https://forum.getkirby.com/t/panel-undefined-variable-page/19761/6 "2020-10-16T16:01:52Z")

</div>

I’ve had a chance to dig around some more and it seems to be related to that as well. If there is a `$page` undefined in the plugin, why would it throw that in the panel but not “on the page”?

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [October 16, 2020, 4:14pm UTC](https://forum.getkirby.com/t/panel-undefined-variable-page/19761/7 "2020-10-16T16:14:42Z")

</div>

> [@DennisAndersson](#):
>
> If there is a `$page` undefined in the plugin, why would it throw that in the panel but not “on the page”?

That’s a good question, maybe it only throws a warning on the frontend but not a fatal error. The more interesting question is why it is somehow called in the Panel in this context-

---

<div class="post-metadata">

**Author:** ![DennisAndersson](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/dennisandersson/32/8319_2.png) [@DennisAndersson](https://forum.getkirby.com/u/DennisAndersson)\
**Post date:** [October 16, 2020, 5:49pm UTC](https://forum.getkirby.com/t/panel-undefined-variable-page/19761/8 "2020-10-16T17:49:49Z")

</div>

I actually remade the plugin, which was based of the example `gallery` included in the starter kit, and the error is gone. I’m not quite sure what I did wrong the first time, only difference is I cleaned up the indentation in the `index.php` file. For all I know it might as well have been a weird cache issue?

I’m still curious as to why it was shown in the panel though.
