Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
eZTemplateFileResource Class Reference

Handles filesystem retrieval of templates. More...

Inheritance diagram for eZTemplateFileResource:

## Public Member Functions
| __construct ( $name="file", $servesStaticData=true)
| resourceName ()
| servesStaticData ()
| templateNodeTransformation ( $functionName, &$node, $tpl, &$resourceData, $parameters, $namespaceValue)
| cacheKey ( $keyData, $res, $templatePath, &$extraParameters)
| hasCachedProcessTree ( $keyData, $uri, $res, $templatePath, &$extraParameters, $timestamp)
| compileTemplate ( $tpl, $keyData, $uri, $res, $templatePath, &$extraParameters, &$resourceData)
| executeCompiledTemplate ( $tpl, &$textElements, $keyData, $uri, $resourceData, $templatePath, &$extraParameters, $timestamp, $rootNamespace, $currentNamespace)
| hasCompiledTemplate ( $keyData, $uri, &$resourceData, $templatePath, &$extraParameters, $timestamp)
| canCompileTemplate ( $tpl, &$resourceData, &$extraParameters)
| cachedTemplateTree ( $keyData, $uri, $res, $templatePath, &$extraParameters, $timestamp)
| setCachedTemplateTree ( $keyData, $uri, $res, $templatePath, &$extraParameters, &$root)
| handleResource ( $tpl, &$resourceData, $method, &$extraParameters)

## Static Public Member Functions
| handleResourceData ( $tpl, $handler, &$resourceData, $method, &$extraParameters)

## Public Attributes
| $Name
| $ServesStaticData
| True if the data served from this resource is static, ie it can be cached properly. More...
| $TemplateCache
| The cache for templates. More...

## Detailed Description

Handles filesystem retrieval of templates.

Templates are loaded from the disk and returned to the template system. The name of the resource is "file:".

Definition at line 19 of file eztemplatefileresource.php.

## Constructor & Destructor Documentation

## ◆ __construct()

eZTemplateFileResource::__construct | ( |  | $name = `"file"`,
|  |  | $servesStaticData = `true`
| ) |  |

Initializes with a default resource name "file". Also sets whether the resource servers static data files, this is needed for the cache system.

Parameters

  string | $name |
  bool | $servesStaticData |

Definition at line 28 of file eztemplatefileresource.php.

## Member Function Documentation

## ◆ cachedTemplateTree()

eZTemplateFileResource::cachedTemplateTree | ( |  | $keyData,
|  |  | $uri,
|  |  | $res,
|  |  | $templatePath,
|  | & | $extraParameters,
|  |  | $timestamp
| ) |  |

Returns
  the cached node tree for the selected template.

Definition at line 139 of file eztemplatefileresource.php.

References eZTemplateTreeCache\cachedTree(), cacheKey(), eZTemplateTreeCache\canRestoreCache(), and eZTemplateTreeCache\restoreCache().

## ◆ cacheKey()

eZTemplateFileResource::cacheKey | ( |  | $keyData,
|  |  | $res,
|  |  | $templatePath,
|  | & | $extraParameters
| ) |  |

Generates a unique key string from the input data and returns it. The key will be used for storing cached data and retrieving cache files. When implementing file resource handlers this key must be reimplemented if the current code does not generate correct keys. However most file based resource handlers can simple reuse this class.

Default implementation returns an md5 of the $keyData.

Definition at line 79 of file eztemplatefileresource.php.

Referenced by cachedTemplateTree(), compileTemplate(), executeCompiledTemplate(), hasCachedProcessTree(), hasCompiledTemplate(), and setCachedTemplateTree().

## ◆ canCompileTemplate()

eZTemplateFileResource::canCompileTemplate | ( |  | $tpl,
|  | & | $resourceData,
|  | & | $extraParameters
| ) |  |

Returns
  `true` if a compiled template can be generated for this request.

Definition at line 131 of file eztemplatefileresource.php.

References eZTemplateCompiler\isCompilationEnabled().

## ◆ compileTemplate()

eZTemplateFileResource::compileTemplate | ( |  | $tpl,
|  |  | $keyData,
|  |  | $uri,
|  |  | $res,
|  |  | $templatePath,
|  | & | $extraParameters,
|  | & | $resourceData
| ) |  |

Sets the cached node tree for the selected template to $root.

Definition at line 100 of file eztemplatefileresource.php.

References cacheKey(), and eZTemplateCompiler\compileTemplate().

## ◆ executeCompiledTemplate()

eZTemplateFileResource::executeCompiledTemplate | ( |  | $tpl,
|  | & | $textElements,
|  |  | $keyData,
|  |  | $uri,
|  |  | $resourceData,
|  |  | $templatePath,
|  | & | $extraParameters,
|  |  | $timestamp,
|  |  | $rootNamespace,
|  |  | $currentNamespace
| ) |  |

Sets the cached node tree for the selected template to $root.

Definition at line 109 of file eztemplatefileresource.php.

References cacheKey(), and eZTemplateCompiler\executeCompilation().

## ◆ handleResource()

eZTemplateFileResource::handleResource | ( |  | $tpl,
|  | & | $resourceData,
|  |  | $method,
|  | & | $extraParameters
| ) |  |

Loads the template file if it exists, also sets the modification timestamp. Returns true if the file exists.

Reimplemented in eZTemplateDesignResource.

Definition at line 161 of file eztemplatefileresource.php.

References handleResourceData().

## ◆ handleResourceData()

eZTemplateFileResource::handleResourceData | ( |  | $tpl,
|  |  | $handler,
|  | & | $resourceData,
|  |  | $method,
|  | & | $extraParameters
| ) |  |
| static

Reusable function for handling file based loading. Call this with the resource handler object in $handler. It will load the template file and handle any charsets conversion if necessary. It will also handle tree node caching if one is found.

Definition at line 173 of file eztemplatefileresource.php.

References eZDebug\accumulatorStart(), eZDebug\accumulatorStop(), eZTextCodec\instance(), eZTemplate\isDebugEnabled(), eZTemplate\RESOURCE_FETCH, eZTemplate\RESOURCE_QUERY, and eZDebug\writeNotice().

Referenced by eZTemplateDesignResource\handleResource(), and handleResource().

## ◆ hasCachedProcessTree()

eZTemplateFileResource::hasCachedProcessTree | ( |  | $keyData,
|  |  | $uri,
|  |  | $res,
|  |  | $templatePath,
|  | & | $extraParameters,
|  |  | $timestamp
| ) |  |

Returns
  the cached node tree for the selected template.

Definition at line 88 of file eztemplatefileresource.php.

References eZTemplateTreeCache\cachedTree(), cacheKey(), eZTemplateTreeCache\canRestoreCache(), and eZTemplateTreeCache\restoreCache().

## ◆ hasCompiledTemplate()

eZTemplateFileResource::hasCompiledTemplate | ( |  | $keyData,
|  |  | $uri,
|  | & | $resourceData,
|  |  | $templatePath,
|  | & | $extraParameters,
|  |  | $timestamp
| ) |  |

Returns
  `true` if a compiled template exists for the current request.

Definition at line 122 of file eztemplatefileresource.php.

References cacheKey(), and eZTemplateCompiler\hasCompiledTemplate().

## ◆ resourceName()

eZTemplateFileResource::resourceName | ( |  | ) |

Returns the name of the resource.

Definition at line 38 of file eztemplatefileresource.php.

References $Name.

## ◆ servesStaticData()

eZTemplateFileResource::servesStaticData | ( |  | ) |

Definition at line 47 of file eztemplatefileresource.php.

References $ServesStaticData.

## ◆ setCachedTemplateTree()

eZTemplateFileResource::setCachedTemplateTree | ( |  | $keyData,
|  |  | $uri,
|  |  | $res,
|  |  | $templatePath,
|  | & | $extraParameters,
|  | & | $root
| ) |  |

Sets the cached node tree for the selected template to $root.

Definition at line 150 of file eztemplatefileresource.php.

References cacheKey(), eZTemplateTreeCache\setCachedTree(), and eZTemplateTreeCache\storeCache().

## ◆ templateNodeTransformation()

eZTemplateFileResource::templateNodeTransformation | ( |  | $functionName,
|  | & | $node,
|  |  | $tpl,
|  | & | $resourceData,
|  |  | $parameters,
|  |  | $namespaceValue
| ) |  |

Reimplemented in eZTemplateDesignResource.

Definition at line 52 of file eztemplatefileresource.php.

References eZTemplateNodeTool\createResourceAcquisitionNode(), and eZTemplate\RESOURCE_FETCH.

## Member Data Documentation

## ◆ $Name

eZTemplateFileResource::$Name

The name of the resource

Definition at line 287 of file eztemplatefileresource.php.

Referenced by resourceName().

## ◆ $ServesStaticData

eZTemplateFileResource::$ServesStaticData

True if the data served from this resource is static, ie it can be cached properly.

Definition at line 289 of file eztemplatefileresource.php.

Referenced by servesStaticData().

## ◆ $TemplateCache

eZTemplateFileResource::$TemplateCache

The cache for templates.

Definition at line 291 of file eztemplatefileresource.php.

The documentation for this class was generated from the following file:

- eztemplatefileresource.php

Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.