classes/phing/tasks/ext/SmartyTask.php
\SmartyTask
A phing task for generating output by using Smarty.
This is based on the TexenTask from Apache's Velocity engine. This class was originally proted in order to provide a template compiling system for Torque.
TODO: - Add Path / useClasspath support?
- Extends from
- \Task
- author
- Hans Lellelid
(SmartyTask) - author
- Jason van Zyl
(TexenTask) - author
- Robert Burrell Donkin
- copyright
- 2001,2002 THYRELL. All rights reserved
- package
- phing.tasks.ext
- version
- $Id: SmartyTask.php 526 2009-08-11 12:11:17Z mrook $
Properties

string
$compilePath= ''
Smarty compiles templates before parsing / replacing tokens in them.
By default it will try ./templates_c, but you may wish to override this.
- Type
- string

string
$configPath= ''
Smarty can use config files.
This tells Smarty where to look for the config files.
- Type
- string

array
$contextProperties= ''
<p> These are properties that are fed into the initial context from a properties file. This is simply a convenient way to set some values that you wish to make available in the context.
These values are not critical, like the template path or output path, but allow a convenient way to set a value that may be specific to a particular generation task.
<
p>
For example, if you are generating scripts to allow
user to automatically create a database, then
you might want the $databaseName
to be placed
in the initial context so that it is available
in a script that might look something like the
following:
#!bin/sh echo y | mysqladmin create $databaseName
The value of $databaseName isn't critical to
output, and you obviously don't want to change
the ant task to simply take a database name.
So initial context values can be set with
properties file.
- Type
- array

string
$controlTemplate= ''
This is the control template that governs the output.
It may or may not invoke the services of worker templates.
- Type
- string

boolean
$forceCompile= 'false'
Whether to force Smarty to recompile templates.
Smarty does check file modification time, but you can set this to be sure that the template will be compiled (of course it will be slower if you do).
falseDetails- Type
- boolean

string
$outputDirectory= ''
This is where texen will place all the output that is a product of the generation process.
- Type
- string

string
$outputFile= ''
This is the file where the generated text will be placed.
- Type
- string

array
$properties= 'array'
Variables that are assigned to the context on parse/compile.
arrayDetails- Type
- array
Methods

cleanup(
)
:
void- throws
- Problem cleaning up.

getCompilePath(
)
:
string| Type | Description |
|---|---|
| string |

getConfigPath(
)
:
string| Type | Description |
|---|---|
| string |

getContextProperties(
)
:
\Properties| Type | Description |
|---|---|
| \Properties |

getControlTemplate(
)
:
string| Type | Description |
|---|---|
| string |

getForceCompile(
)
:
boolean| Type | Description |
|---|---|
| boolean |

getOutputFile(
)
:
string| Type | Description |
|---|---|
| string |

getTemplatePath(
)
:
string| Type | Description |
|---|---|
| string |

initControlContext(
)
:
\Smarty| Type | Description |
|---|---|
| \Smarty |
- throws
- the execute method will catch and rethrow as a
BuildException

main(
)
:
- throws
- BuildExceptions are thrown when required attributes are missing. Exceptions thrown by Velocity are rethrown as BuildExceptions.

populateInitialContext(
\context $context
)
:
voidPlace useful objects into the initial context.
TexenTask places Date().toString() into the
context as $now. Subclasses who want to vary the
objects in the context should override this method.
$generator is not put into the context in this
method.
| Name | Type | Description |
|---|---|---|
| $context | \context | The context to populate, as retrieved from {@link #initControlContext()}. |
- throws
- Error while populating context. The {@link #execute()} method will catch and rethrow as a
BuildException.

setCompilePath(
string $compilePath
)
:
| Name | Type | Description |
|---|---|---|
| $compilePath | string |

setConfigPath(
string $configPath
)
:
void| Name | Type | Description |
|---|---|---|
| $configPath | string |

setContextProperties(
string $file
)
:
void| Name | Type | Description |
|---|---|---|
| $file | string |

setControlTemplate(
string $controlTemplate
)
:
void| Name | Type | Description |
|---|---|---|
| $controlTemplate | string |

setForceCompile(
boolean $force
)
:
void| Name | Type | Description |
|---|---|---|
| $force | boolean |

setLeftDelimiter(
string $delim
)
:
void| Name | Type | Description |
|---|---|---|
| $delim | string |

setOutputDirectory(
\PhingFile $outputDirectory
)
:
void| Name | Type | Description |
|---|---|---|
| $outputDirectory | \PhingFile |
- throws

setOutputFile(
$outputFile
)
:
void| Name | Type | Description |
|---|---|---|
| $outputFile |

setRightDelimiter(
string $delim
)
:
void| Name | Type | Description |
|---|---|---|
| $delim | string |