Zeta Components Manual :: Docs For Class ezcTemplateCustomFunctionDefinition
Template::ezcTemplateCustomFunctionDefinition
Class ezcTemplateCustomFunctionDefinition
Contains the definition of a custom function.
Example of use: create a function to hide a mail address.
- Create a class which implements ezcTemplateCustomFunction and which
- class htmlFunctions implements ezcTemplateCustomFunction
- {
- public static function getCustomFunctionDefinition( $name )
- {
- switch ($name )
- {
- case "hide_mail":
- $def->class = __CLASS__;
- $def->method = "hide_mail";
- $def->parameters = array( "mailAddress" );
- return $def;
- }
- return false;
- }
- public static function hide_mail( $mailAddress )
- {
- $old = array( '@', '.' );
- $new = array( ' at ', ' dot ' );
- }
- }
2. Assign the class to the Template configuration in your application.
- $config->addExtension( "htmlFunctions" );
3. Use the custom function in the template.
- {hide_mail( "john.doe@example.com" )}
Source for this file: /Template/src/structs/custom_function_definition.php
ezcTemplateCustomExtension | --ezcTemplateCustomFunctionDefinition
Version: | //autogen// |
Member Variables
public string |
$class
Holds the (static) class that implements the function to be executed. |
public string |
$method
Holds the (static) method that should be run. |
public array(string) |
$parameters
= array()
Holds the required and optional named parameters for this custom function. The optional parameters should be specified after the required parameters.
|
public bool |
$sendTemplateObject
= false
Whether or not the Template object is available in the custom function. Be aware that if you change this, your custom function's signature changes as the first argument will then be the template object. |
public bool |
$variableArgumentList
= false
Whether or not the custom function can have an undefined amount of parameters. The maximum amount of parameters check will be omitted. The custom function implementation will most probably use PHP function: func_get_args() or simular. |
Documentation generated by phpDocumentor 1.4.3