Skip to content
This repository has been archived by the owner on Jan 12, 2023. It is now read-only.

Undefined variable $page #1

Open
skylennard opened this issue Jun 16, 2021 · 8 comments
Open

Undefined variable $page #1

skylennard opened this issue Jun 16, 2021 · 8 comments

Comments

@skylennard
Copy link

I'm trying to implement this connector (v0.1.2) in my Statamic v3.1.23 site and I'm getting this undefined variable $page error.

When troubleshooting, I've discovered it's happening due to $page->augmentedValue('template') === 'app' being false (in InertiaStatamic.php), so the Inertia render isn't triggered. If I note out this conditional statement, then the page seems to load!

From what I can tell now, there's no template value being augmented anymore that indicates which template is rendering the requested path?

This is definitely confusing...

Help?

Thanks so much!

@hotmeteor
Copy link
Owner

What's your root page called? It should be app.php

@skylennard
Copy link
Author

skylennard commented Jun 17, 2021

I'm not sure which page you're referring to...?

in /server.php, there's the Laravel standard require_once __DIR__.'/public/index.php';, does this need to be app.php instead?

(that index.php file is the one that comes packaged with Laravel)

The base view for this site is using /views/app.blade.php, and the base Vue application is at /resources/js/App.vue.

What am I missing?

@hotmeteor
Copy link
Owner

No, your Inertia root template. See https://inertiajs.com/server-side-setup

@skylennard
Copy link
Author

So it needs to be /views/app.php, not /views/app.blade.php?

@hotmeteor
Copy link
Owner

Shoot sorry, no. It should be /views/app.blade.php.

@skylennard
Copy link
Author

Ok cool, so yes that’s already set up…I’m pretty sure I’ve followed all the directions so it’s confusing for sure. When that condition in this library is noted out, the page loads with the initial data attribute populated, and I assume it would work from there as expected…

@hotmeteor
Copy link
Owner

@skylennard Did you ever work this out?

@jonlemarquand
Copy link

Hi Adam,

Think I've at least managed to recreate this one, or something similar. Steps to recreate:

  • New install of Statamic/Inertia (no content)
  • Update page 'Home'
  • Add template to 'blueprint' and set to 'app'

For whatever reason, Statamic was saving with template 'home' and template_field 'app'. Updating it in the .md file seemed to work.

Screenshot 2022-05-06 at 20 46 09

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants