(Vegvisir 2, Vegvisir 3)
VV::embed()
Import and inline the contents of any file without executing code.
VV::embed()
returns the contents of any file as a string.
pathname
Path to a file to embed relative from project root.
relative
Path provided to pathname
will be a relative when this parameter is true
(default). Set to false
to make path absolute.
string
A string containing the raw contents of the file. File encoding is preserved.
Will return an empty string if the path provided to pathname
is not a valid file, or if it failed to import.
Here is an example the embeds an SVG file directly on a page.
This can come in handy for inlining small vector icons.
= Snippet::put("docs/API/PHP/VV/embed/example-1-0", Snippet::PHP) ?> = Snippet::put("docs/API/PHP/VV/embed/example-1-1", Snippet::PHP) ?>By using VV::css()
inside a style
, we've enabled this stylesheet for that specific page.