VV::include()

Inject the compiled output of another Vegvisir page (or other PHP script).

Parameters

string

$pathname

Path to another Vegvisir page or other PHP file.

bool

$relative

Flag which when set to:

  1. true

    Will make $pathname look for a source file relative to root_path.

  2. false

    Will make $pathname look for a source file relative to the root of the whole filesystem.

Return value

string

Returns a minified version of the included source file as a string. If a file can not be found at $pathname, an empty string is returned.


Examples

Importing a code snippet into a page

In this example we will be including a PHP file that contains reusable code (a banner) from /snippets/banner.php into a Vegvisir page /public/index.php.