![]() |
Grima
2018-08
Whispering into Alma's ear
|
Simple template engine. More...
Public Member Functions | |
| __construct () | |
| Setup default scopes and paths, but leave base dirs empty. More... | |
| splat ( $name, $scope=array()) | |
Main function: execute template $name with given $scope More... | |
| addPaths (array $paths) | |
Add a resolution of $name to $relativePath More... | |
| addBases ( $bases) | |
Add a base directory to resolve $relativePath to $absolutePath More... | |
Protected Member Functions | |
| push (array $scope) | |
| push a scope onto the stack More... | |
| peek () | |
| peek at current scope More... | |
| pop () | |
| pop a scope off the stack More... | |
| nameToPaths ($name) | |
Resolve a template $name to an array of absolute $paths. More... | |
Private Attributes | |
| $paths | |
| $bases | |
| $stack | |
Simple template engine.
Definition at line 12 of file grima-splats.php.
| zemowsplat\Splat::__construct | ( | ) |
Setup default scopes and paths, but leave base dirs empty.
Definition at line 45 of file grima-splats.php.
| zemowsplat\Splat::addBases | ( | $bases | ) |
Add a base directory to resolve $relativePath to $absolutePath
| string | array | $bases | - beginnings of absolute paths to search for relative paths |
Definition at line 111 of file grima-splats.php.
| zemowsplat\Splat::addPaths | ( | array | $paths | ) |
Add a resolution of $name to $relativePath
| array | $paths | - associative array of $name => $path pairs to setup path resolution |
Definition at line 101 of file grima-splats.php.
|
protected |
Resolve a template $name to an array of absolute $paths.
In case of additions, the array may be long, but is usually a single path to be included in order to print the template.
| string | $name | - name of the template to lookup |
Definition at line 125 of file grima-splats.php.
|
protected |
peek at current scope
Definition at line 29 of file grima-splats.php.
|
protected |
pop a scope off the stack
Definition at line 38 of file grima-splats.php.
|
protected |
push a scope onto the stack
| array | $scope | - the new scope to be merged with old scope |
Definition at line 21 of file grima-splats.php.
| zemowsplat\Splat::splat | ( | $name, | |
$scope = array() |
|||
| ) |
Main function: execute template $name with given $scope
There are two convenience variables:
$e = htmlspecialchars - suitable for $t = $this->splat - suitable for calling more templates.Technically any PHP code is valid in the template, but it is intended to be used on text/html heavy templates with some:
and some
and some
with some
and that's basically it.
| string | $name | - name of the template to execute |
| array | $scope | - additional variables in scope of the template |
Definition at line 87 of file grima-splats.php.
|
private |
Definition at line 14 of file grima-splats.php.
|
private |
Definition at line 13 of file grima-splats.php.
|
private |
Definition at line 16 of file grima-splats.php.
1.8.14