* Hello word!
* {include dynloc("my_template.ezt")}
*
*
* With the following custom function definition:
*
* class DynLocCF implements ezcTemplateCustomFunction
* {
* public static function getCustomFunctionDefinition( $name )
* {
* if ( $name === "dynloc" )
* {
* $def = new ezcTemplateCustomFunctionDefinition();
* $def->class = __CLASS__;
* $def->method = "dynloc";
* $def->sendTemplateObject = true;
* return $def;
* }
* return false;
* }
*
* public static function dynloc($templateObj, $name)
* {
* return new DynamicLocation($templateObj, $name);
* }
* }
*
*
* The dynloc() method returns a new DynamicLocation object. A
* simple implementation of the ezcTemplateLocationInterface is shown below:
*
*
* class DynamicLocation implements ezcTemplateLocationInterface
* {
* protected $templatePath;
* protected $templateName;
*
* public function __construct( $templateObj, $templateName)
* {
* $this->templateName = $templateName;
* $this->templatePath = $templateObj->usedConfiguration->templatePath;
* }
*
* public function getPath()
* {
* $loc = $this->templatePath ."/". $this->templateName;
* if ( !file_exists( $loc ) )
* {
* $loc = "/fallback/" . $this->templateName;
* }
*
* return $loc;
* }
* }
*
*
* The template will first try to use the original template. If that template
* does not exist, it uses the fallback template.
*
* @package Template
* @version //autogen//
*/
interface ezcTemplateLocation
{
/**
* Implement this method to return the path to the template source.
* The original template name is set with any other method.
*
* @return string Path to the template source.
*/
public function getPath();
}
?>