Forum
Global includes in layout files
Hi,
On my index.php page, I have included a vars.php file that holds php variables, but my layout files on index.php (global.header and global.footer) can't access the variables.
Do I have to include the vars.php file on all the layout templates as well? Is there a better way to do all of this?
Thanks,
-Rob
You can pass them into scope using layout variables
https://docs.grabaperch.com/docs/layouts/variables/
Ok, thanks Drew.
Is there a way to declare an array as a layout variable?
Like:
And then, on the layout page something like:
I know that won't work, but is something like that possible?
Then in your layout
Awesome. Thanks!
This part threw the error:
Illegal string offset 'phone'
But this works:
Err, yes, sorry.