I get how to pass a variable into a layout, like this:
Then inside head.php I'd use this:
which would output THIS IS A DEMO. Great.
Is it possible to do the reverse? Pull a variable out of perch_layout('head')?
At the top of post.php I have perch_layout('head'), this contains lots of global php variables I'd like reuse in other templates.
As an example, in perch_layout('head') I have this variable:
I'd like to use $test in post.php
In perch debug I get an error: [message] => Undefined variable: test
Is there a way to use $test in a template without having to recreate it?