Capsule is a simple "template" engine that essentially provides an isolated context for PHP scripts.
There is no special templating language, and therefore no limitations to what can be accomplished within templates. The main purpose of Capsule is to separate the business logic from display / output logic.
| author |
Hans Lellelid hans@xmpl.org |
|---|---|
| version |
$Id$ |
| package |
phing.lib |
__construct()
clear(mixed $which = null) : void
mixedString name of var, or array of names.
setTemplatePath(string $v)
string
getTemplatePath() : string
string
setOutputDirectory(string $v)
string
getOutputDirectory() : string
string
display(string $__template) : void
| throws |
|
|---|
string
parse(string $template, string $outputFile = null, boolean $append = false) : string
| throws |
|
|---|
stringThe template filename (relative to templatePath or absolute).
stringIf specified, contents of template will also be written to this file.
booleanShould output be appended to source file?
stringThe "parsed" template output.
resolvePath(string $file, string $basepath) : string
stringFile name or possibly absolute path.
stringThe basepath that should be prepended if $file is not absolute.
string"Best guess" path for this file.
get(string $name) : mixed
stringVariable name to retrieve.
mixed
putAll(array $vars, boolean $recursiveMerge = false) : void
Given an array like:
array( 'myvar' => 'Hello',
'myvar2' => 'Hello')
Resulting template will have access to $myvar and $myvar2.
array
booleanShould matching keys be recursively merged?
put(string $name, mixed $value)
Resulting template will have access to ${$name$} variable.
string
mixed
putRef(mixed $name, $value)
This means that if the template modifies the variable, then it will also be modified in the context.
mixed
putCopy(string $name, mixed $value)
This is primarily to force copying (cloning) of objects, rather than the default behavior which is to assign them by reference.
string
mixed
templatePath : string
| var |
|---|
string
outputDirectory : string
| var |
|---|
string
vars : array
| var |
Hash of variables. |
|---|
array
initialized :
old_include_path : string
| var |
|---|
string