Ubiquity 2.5.2
php rapid development framework
Loading...
Searching...
No Matches
TemplateEngine Class Reference

Abstract template engine. More...

+ Inheritance diagram for TemplateEngine:

Public Member Functions

 render (string $viewName, ?array $pData=[], bool $asString=false)
 Renders a view.
 
 getBlockNames (string $templateName)
 Returns the defined block names.
 
 getCode (string $templateName)
 Returns the source code of the template.
 
 addFunction (string $name, $callback, array $options=[])
 
 exists (string $name)
 Checks if we have the source code of a template, given its name.
 
 setTheme (string $theme, string $themeFolder=ThemesManager::THEMES_FOLDER)
 Defines the activeTheme.
 
 getGenerator ()
 
 generateTemplateSourceFromFile (string $templateName)
 Generates the source for this engine from a twig model template.
 
 generateTemplateSource (string $source)
 

Protected Member Functions

 addFilter (string $name, $callback, array $options=[])
 
 addExtension ($extension)
 
 hasThemeResource (&$resource)
 
 addFunctions ()
 
 safeString (string $str)
 

Protected Attributes

Framework $fw
 

Detailed Description

Abstract template engine.

Ubiquity\views\engine$TemplateEngine This class is part of Ubiquity

Author
jcheron myadd.nosp@m.ress.nosp@m.mail@.nosp@m.gmai.nosp@m.l.com
Version
1.1.0

Definition at line 21 of file TemplateEngine.php.

Member Function Documentation

◆ addExtension()

addExtension (   $extension)
abstractprotected

Reimplemented in MicroTemplateEngine, and Twig.

◆ addFilter()

addFilter ( string  $name,
  $callback,
array  $options = [] 
)
abstractprotected
Parameters
string$name
$callback
array$options
Returns
void

Reimplemented in MicroTemplateEngine, and Twig.

◆ addFunction()

addFunction ( string  $name,
  $callback,
array  $options = [] 
)
abstract
Parameters
string$name
$callback
array$options
Returns
void

Reimplemented in MicroTemplateEngine, and Twig.

◆ addFunctions()

addFunctions ( )
protected

Reimplemented in Twig.

Definition at line 99 of file TemplateEngine.php.

◆ exists()

exists ( string  $name)
abstract

Checks if we have the source code of a template, given its name.

Parameters
string$name
Returns
boolean

Reimplemented in MicroTemplateEngine, and Twig.

◆ generateTemplateSource()

generateTemplateSource ( string  $source)

Definition at line 163 of file TemplateEngine.php.

◆ generateTemplateSourceFromFile()

generateTemplateSourceFromFile ( string  $templateName)

Generates the source for this engine from a twig model template.

Parameters
string$templateName
Returns
string

Definition at line 158 of file TemplateEngine.php.

◆ getBlockNames()

getBlockNames ( string  $templateName)
abstract

Returns the defined block names.

Parameters
string$templateName

Reimplemented in MicroTemplateEngine, and Twig.

◆ getCode()

getCode ( string  $templateName)
abstract

Returns the source code of the template.

Parameters
string$templateName

Reimplemented in MicroTemplateEngine, and Twig.

◆ getGenerator()

getGenerator ( )
abstract

Reimplemented in MicroTemplateEngine, and Twig.

◆ hasThemeResource()

hasThemeResource ( $resource)
protected

Definition at line 74 of file TemplateEngine.php.

◆ render()

render ( string  $viewName,
?array  $pData = [],
bool  $asString = false 
)
abstract

Renders a view.

Parameters
string$viewName
array | null$pData
boolean$asString

Reimplemented in MicroTemplateEngine, and Twig.

◆ safeString()

safeString ( string  $str)
protected

Definition at line 147 of file TemplateEngine.php.

◆ setTheme()

setTheme ( string  $theme,
string  $themeFolder = ThemesManager::THEMES_FOLDER 
)

Defines the activeTheme.

activeTheme namespace is @activeTheme

Parameters
string$theme
string$themeFolder
Exceptions
ThemesException

Reimplemented in Twig.

Definition at line 87 of file TemplateEngine.php.

Field Documentation

◆ $fw

Framework $fw
protected

Definition at line 23 of file TemplateEngine.php.


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