Roots
The $roots
object gives you access to the roots of the different folders that make up your Kirby installation. This is useful whenever you want to access those folders to fetch a file from a folder etc.
- $kirby->root('accounts')
- $kirby->root('assets')
- $kirby->root('blueprints')
- $kirby->root('cache')
- $kirby->root('collections')
- $kirby->root('commands')
- $kirby->root('config')
- $kirby->root('content')
- $kirby->root('controllers')
- $kirby->root('i18n')
- $kirby->root('i18n:rules')
- $kirby->root('i18n:translations')
- $kirby->root('index')
- $kirby->root('kirby')
- $kirby->root('languages')
- $kirby->root('license')
- $kirby->root('logs')
- $kirby->root('media')
- $kirby->root('models')
- $kirby->root('panel')
- $kirby->root('plugins')
- $kirby->root('roles')
- $kirby->root('sessions')
- $kirby->root('site')
- $kirby->root('snippets')
- $kirby->root('templates')
Accessing the $roots
object
Before you can call the method, you need access to the roots object:
This will return an object with all the roots of the installation.
With the object in place, you can now call the available roots methods.
Instead of the following syntax to access the folders:
you can also use the root()
method to access an individual root directly: