VELOX API Docs

Compiler
in package

A class that offers some utility functions to require, parse, and compile view files.

Tags
since
1.5.4

Table of Contents

compile()  : string
Compiles a PHP file with the passed variables.
parse()  : string
Parses a file through the templating engine and returns a path to the compiled file.
require()  : void
Requires a PHP file and pass it the passed variables.
resolve()  : string
Resolves a file from the active theme or inherits it from a parent theme.

Methods

compile()

Compiles a PHP file with the passed variables.

public static compile(string $file, string $type[, array<string|int, mixed>|null $variables = null ]) : string
Parameters
$file : string

An absolute path to the file that should be compiled.

$type : string

The type of the file (just a name to make for friendly exceptions).

$variables : array<string|int, mixed>|null = null
Tags
throws
Exception

If failed to compile the file.

Return values
string

parse()

Parses a file through the templating engine and returns a path to the compiled file.

public static parse(string $file) : string
Parameters
$file : string

The file to parse.

Return values
string

require()

Requires a PHP file and pass it the passed variables.

public static require(string $file[, array<string|int, mixed>|null $variables = null ]) : void
Parameters
$file : string

An absolute path to the file that should be compiled.

$variables : array<string|int, mixed>|null = null

[optional] An associative array of the variables to pass.

Tags
throws
Exception

If the file could not be loaded.

Return values
void

resolve()

Resolves a file from the active theme or inherits it from a parent theme.

public static resolve(string $file) : string
Parameters
$file : string
Return values
string

Search results