(Vegvisir 3)

VV::root()

Return an absolute path to a file or folder relative from project root.

Description

Return an absolute path to a file or folder relative from project root. This method does not process the entity at the provided location in any way. It simply returns an absolute path to it, which can be used with other functions.

Parameters

pathname

Path to a location relative from project root. This parameter is an empty string by default, which will return an absolute path to project root itself.

Example

Return values

string

An absolute path to the relative location provided by pathname.

Example

Examples

Basic usage

VV::root() doesn't do anything on its own other than "convert" a relative path into an absolute one.

This can come in really handy when importing other PHP classes within your project. Let's import a PHP class from one location in the project into a public page.

Let's import and use this class on our page with VV::root().