(Vegvisir 3)
VV::shell()
Wrap contents of a page within another page.
This method is similar to VV::include()
except it lets you place persistent content around the included page.
VV::shell()
is a powerful method which lets you put the contents of one page into a vv-shell
tag on another page.
Subsequent navigations to pages using the same shell will preserve the outer shell's state. The shell will not be fetched again.
pathname
Path to a PHP shell page relative from project root which the contents of the initiator page will be wrapped inside.
This method is buffered and will flush the buffer contents to stdout
when the last shell has been imported.
If we want the contents of page /public/some-page.php
wrapped inside the contents of /shells/some-shell.php
, we can do the following:
Place a VV::shell()
snippet at the end of the page you wish to wrap.
Now let's add a vv-shell
tag somewhere in our /shells/some-shell.php
file.
The contents of /public/some-page.php
will replace the inner contents of the vv-shell
tag.
The shell file acts like any other Vegvisir page, which means you have access to all VV
methods.