phing-tasks-ext

# Class: SmartyTask Source Location: /tasks/ext/SmartyTask.php
### Class Overview
    ProjectComponent
       |
       --Task
          |
          --SmartyTask
A phing task for generating output by using Smarty. #### Author(s): Robert Burrell Donkin <robertdonkin@mac.com> Hans Lellelid <hans@xmpl.org> (SmartyTask) Jason van Zyl <jvanzyl@apache.org> (TexenTask) #### Version: $Id: SmartyTask.php 526 2009-08-11 12:11:17Z mrook $ #### Copyright: � 2001,2002 THYRELL. All rights reserved | ### Variables $compilePath $configPath $context $contextProperties $controlTemplate $forceCompile $leftDelimiter $outputDirectory $outputFile $properties $rightDelimiter $templatePath | ### Methods cleanup getCompilePath getConfigPath getContextProperties getControlTemplate getForceCompile getLeftDelimiter getOutputDirectory getOutputFile getRightDelimiter getTemplatePath init initControlContext main populateInitialContext setCompilePath setConfigPath setContextProperties setControlTemplate setForceCompile setLeftDelimiter setOutputDirectory setOutputFile setRightDelimiter setTemplatePath
### Inherited Variables #### Class: Task Task::$description Task::$location Task::$target Task::$taskName Task::$taskType Task::$wrapper #### Class: ProjectComponent ProjectComponent::$project | ### Inherited Methods #### Class: Task Task::getDescription() Returns the textual description of the task Task::getLocation() Returns the location within the buildfile this task occurs. Used by BuildException to give detailed error messages. Task::getOwningTarget() Returns the owning target of this task. Task::getRegisterSlot() Returns a name Task::getRuntimeConfigurableWrapper() Returns the wrapper object for runtime configuration Task::getTaskName() Returns the name of task, used only for log messages Task::getTaskType() Returns the name of the task under which it was invoked, usually the XML tagname Task::init() Called by the parser to let the task initialize properly. Task::log() Provides a project level log event to the task. Task::main() Called by the project to let the task do it's work. This method may be called more than once, if the task is invoked more than once. For example, if target1 and target2 both depend on target3, then running <em>phing target1 target2</em> will run all tasks in target3 twice. Task::maybeConfigure() Configure this task if it hasn't been done already. Task::perform() Perfrom this task Task::setDescription() Sets a textual description of the task Task::setLocation() Sets the location within the buildfile this task occurs. Called by the parser to set location information. Task::setOwningTarget() Sets the owning target this task belongs to. Task::setRuntimeConfigurableWrapper() Sets the wrapper object this task should use for runtime configurable elements. Task::setTaskName() Sets the name of this task for log messages Task::setTaskType() Sets the type of the task. Usually this is the name of the XML tag #### Class: ProjectComponent ProjectComponent::getProject() Returns a reference to current project ProjectComponent::log() Logs a message with the given priority. ProjectComponent::setProject() References the project to the current component.
### Class Details [line 43] 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? #### Tags:
author: | Robert Burrell Donkin <robertdonkin@mac.com>
author: | Hans Lellelid <hans@xmpl.org> (SmartyTask)
author: | Jason van Zyl <jvanzyl@apache.org> (TexenTask)
version: | $Id: SmartyTask.php 526 2009-08-11 12:11:17Z mrook $
copyright: | � 2001,2002 THYRELL. All rights reserved
[ Top ] ### Class Variables #### $compilePath = [line 127] Smarty compiles templates before parsing / replacing tokens in them. By default it will try ./templates_c, but you may wish to override this. #### Tags:
access: | protected
Type: | string
[ Top ] #### $configPath = [line 143] Smarty can use config files. This tells Smarty where to look for the config files. #### Tags:
access: | protected
Type: | string
[ Top ] #### $context = [line 49] Smarty template engine. #### Tags:
access: | protected
Type: | Smarty
[ Top ] #### $contextProperties = [line 120] <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. </p> <p> 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> <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: <pre> #!bin/sh echo y | mysqladmin create $databaseName </pre> 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. #### Tags:
access: | protected
Type: | array
[ Top ] #### $controlTemplate = [line 63] This is the control template that governs the output. It may or may not invoke the services of worker templates. #### Tags:
access: | protected
Type: | string
[ Top ] #### $forceCompile = false [line 136] 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). #### Tags:
access: | protected
Type: | boolean
[ Top ] #### $leftDelimiter = [line 149] Customize the left delimiter for Smarty tags. #### Tags:
access: | protected
Type: | string
[ Top ] #### $outputDirectory = [line 77] This is where texen will place all the output that is a product of the generation process. #### Tags:
access: | protected
Type: | string
[ Top ] #### $outputFile = [line 84] This is the file where the generated text will be placed. #### Tags:
access: | protected
Type: | string
[ Top ] #### $properties = array() [line 55] Variables that are assigned to the context on parse/compile. #### Tags:
access: | protected
Type: | array
[ Top ] #### $rightDelimiter = [line 155] Customize the right delimiter for Smarty tags. #### Tags:
access: | protected
Type: | string
[ Top ] #### $templatePath = [line 70] This is where Velocity will look for templates using the file template loader. #### Tags:
access: | protected
Type: | string
[ Top ] ### Class Methods ### method cleanup [line 608]
`void cleanup( )`
A hook method called at the end of #execute() which can be overridden to perform any necessary cleanup activities (such as the release of database connections, etc.). By default, does nothing. #### Tags:
throws: | Exception Problem cleaning up.
access: | protected
[ Top ] ### method getCompilePath [line 285]
`string getCompilePath( )`
Get the path Smarty uses for compiling templates. #### Tags:
access: | public
[ Top ] ### method getConfigPath [line 319]
`string getConfigPath( )`
Get the path that Smarty uses for looking for config files. #### Tags:
access: | public
[ Top ] ### method getContextProperties [line 410]
`Properties getContextProperties( )`
Get the context properties that will be fed into the initial context be the generating process starts. #### Tags:
access: | public
[ Top ] ### method getControlTemplate [line 184]
`string getControlTemplate( )`
Get the control template for the generating process. #### Tags:
access: | public
[ Top ] ### method getForceCompile [line 302]
`boolean getForceCompile( )`
Get whether Smarty should always recompile template. #### Tags:
access: | public
[ Top ] ### method getLeftDelimiter [line 336]
`string getLeftDelimiter( )`
Get Smarty template right delimiter #### Tags:
access: | public
[ Top ] ### method getOutputDirectory [line 251]
`string getOutputDirectory( )`
Get the output directory. #### Tags:
access: | public
[ Top ] ### method getOutputFile [line 269]
`string getOutputFile( )`
Get the output file for the generation process. #### Tags:
access: | public
[ Top ] ### method getRightDelimiter [line 353]
`string getRightDelimiter( )`
Get Smarty template right delimiter #### Tags:
access: | public
[ Top ] ### method getTemplatePath [line 222]
`string getTemplatePath( )`
Get the path where Velocity will look for templates using the file template loader. #### Tags:
access: | public
[ Top ] ### method init [line 162]
`void init( )`
#### Tags:
access: | public
Overrides Task::init() (Called by the parser to let the task initialize properly.) [ Top ] ### method initControlContext [line 426]
`Smarty initControlContext( )`
Creates a Smarty object. #### Tags:
return: | initialized (cleared) Smarty context.
throws: | Exception the execute method will catch and rethrow as a BuildException
access: | public
[ Top ] ### method main [line 438]
`void main( )`
Execute the input script with Velocity #### Tags:
throws: | BuildException BuildExceptions are thrown when required attributes are missing. Exceptions thrown by Velocity are rethrown as BuildExceptions.
access: | public
Overrides Task::main() (Called by the project to let the task do it's work. This method may be called more than once, if the task is invoked more than once. For example, if target1 and target2 both depend on target3, then running <em>phing target1 target2</em> will run all tasks in target3 twice.) [ Top ] ### method populateInitialContext [line 597]
`void populateInitialContext( $context)`
<p>Place useful objects into the initial context.</p> 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. #### Tags:
throws: | Exception Error while populating context. The #execute() method will catch and rethrow as a BuildException .
access: | protected
#### Parameters:
context | $context | The context to populate, as retrieved from #initControlContext().
[ Top ] ### method setCompilePath [line 277]
`void setCompilePath( string $compilePath)`
Set the path Smarty uses as a "cache" for compiled templates. #### Tags:
access: | public
#### Parameters:
string | $compilePath |
[ Top ] ### method setConfigPath [line 311]
`void setConfigPath( string $configPath)`
Set where Smarty looks for config files. #### Tags:
access: | public
#### Parameters:
string | $configPath |
[ Top ] ### method setContextProperties [line 365]
`void setContextProperties( string $file)`
Set the context properties that will be fed into the initial context be the generating process starts. #### Tags:
access: | public
#### Parameters:
string | $file |
[ Top ] ### method setControlTemplate [line 175]
`void setControlTemplate( string $controlTemplate)`
[REQUIRED] Set the control template for the generating process. #### Tags:
access: | public
#### Parameters:
string | $controlTemplate |
[ Top ] ### method setForceCompile [line 294]
`void setForceCompile( boolean $force)`
Set whether Smarty should always recompile tempaltes. #### Tags:
access: | public
#### Parameters:
boolean | $force |
[ Top ] ### method setLeftDelimiter [line 328]
`void setLeftDelimiter( string $delim)`
Set Smarty template left delimiter. #### Tags:
access: | public
#### Parameters:
string | $delim |
[ Top ] ### method setOutputDirectory [line 233]
`void setOutputDirectory( $outputDirectory)`
[REQUIRED] Set the output directory. It will be created if it doesn't exist. #### Tags:
throws: | Exception
access: | public
#### Parameters:
PhingFile | $outputDirectory |
[ Top ] ### method setOutputFile [line 260]
`void setOutputFile( $outputFile)`
[REQUIRED] Set the output file for the generation process. #### Tags:
access: | public
#### Parameters:
| $outputFile |
[ Top ] ### method setRightDelimiter [line 345]
`void setRightDelimiter( string $delim)`
Set Smarty template right delimiter. #### Tags:
access: | public
#### Parameters:
string | $delim |
[ Top ] ### method setTemplatePath [line 195]
`void setTemplatePath( $templatePath)`
[REQUIRED] Set the path where Velocity will look for templates using the file template loader. #### Tags:
throws: | Exception
access: | public
#### Parameters:
| $templatePath |
[ Top ] Documentation generated on Mon, 19 Oct 2009 10:52:02 +0200 by phpDocumentor 1.4.3