Class SmartyTemplateCompiler

package Smarty
subpackage Compiler

 Methods

Initialize compiler

__construct(string $lexer_class, string $parser_class, \Smarty $smarty) 

Parameters

$lexer_class

string

class name

$parser_class

string

class name

$smarty

\Smarty

global instance

lazy loads internal compile plugin for tag and calls the compile methode

callTagCompiler(string $tag, array $args, mixed $param1, mixed $param2, mixed $param3) : string
Inherited

compile objects cached for reuse. class name format: Smarty_Internal_Compile_TagName plugin filename format: Smarty_Internal_Tagname.php

inherited_from \Smarty_Internal_TemplateCompilerBase::callTagCompiler()

Parameters

$tag

string

tag name

$args

array

list of tag attributes

$param1

mixed

optional parameter

$param2

mixed

optional parameter

$param3

mixed

optional parameter

Returns

stringcompiled code

Compile Tag

compileTag(string $tag, array $args, array $parameter) : string
Inherited

This is a call back from the lexer/parser It executes the required compile plugin for the Smarty tag

inherited_from \Smarty_Internal_TemplateCompilerBase::compileTag()

Parameters

$tag

string

tag name

$args

array

array with tag attributes

$parameter

array

array with compilation parameter

Returns

stringcompiled code

Method to compile a Smarty template

compileTemplate(\Smarty_Internal_Template $template) : bool
Inherited
inherited_from \Smarty_Internal_TemplateCompilerBase::compileTemplate()

Parameters

$template

\Smarty_Internal_Template

template object to compile

Returns

booltrue if compiling succeeded, false if it failed

Check for plugins and return function name

getPlugin($plugin_name, string $plugin_type) : string
Inherited
inherited_from \Smarty_Internal_TemplateCompilerBase::getPlugin()

Parameters

$plugin_name

$plugin_type

string

type of plugin

Returns

stringcall name of function

Check for plugins by default plugin handler

getPluginFromDefaultHandler(string $tag, string $plugin_type) : boolean
Inherited
inherited_from \Smarty_Internal_TemplateCompilerBase::getPluginFromDefaultHandler()

Parameters

$tag

string

name of tag

$plugin_type

string

type of plugin

Returns

booleantrue if found

Inject inline code for nocache template sections

processNocacheCode(string $content, boolean $is_code) : string
Inherited

This method gets the content of each template element from the parser. If the content is compiled code and it should be not cached the code is injected into the rendered output.

inherited_from \Smarty_Internal_TemplateCompilerBase::processNocacheCode()

Parameters

$content

string

content of template element

$is_code

boolean

true if content is compiled code

Returns

stringcontent

display compiler error messages without dying

trigger_template_error(string $args, string $line) 
Inherited

If parameter $args is empty it is a parser detected syntax error. In this case the parser is called to obtain information about expected tokens.

If parameter $args contains a string this is used as error message

inherited_from \Smarty_Internal_TemplateCompilerBase::trigger_template_error()

Parameters

$args

string

individual error message or null

$line

string

line-number

Exceptions

\SmartyCompilerException when an unexpected token is found

Methode to compile a Smarty template

doCompile(mixed $_content) : bool

Parameters

$_content

mixed

template source

Returns

booltrue if compiling succeeded, false if it failed

 Properties

 

$_tag_objects : array
Inherited
inherited_from \Smarty_Internal_TemplateCompilerBase::$$_tag_objects
 

$_tag_stack : array
Inherited
inherited_from \Smarty_Internal_TemplateCompilerBase::$$_tag_stack
 

$called_functions : array
Inherited
inherited_from \Smarty_Internal_TemplateCompilerBase::$$called_functions
 

$compiles_template_function : bool
Inherited
inherited_from \Smarty_Internal_TemplateCompilerBase::$$compiles_template_function
 

$default_handler_plugins : array
Inherited
inherited_from \Smarty_Internal_TemplateCompilerBase::$$default_handler_plugins
 

$default_modifier_list : mixed
Inherited
inherited_from \Smarty_Internal_TemplateCompilerBase::$$default_modifier_list
 

$forceNocache : boolean
Inherited
inherited_from \Smarty_Internal_TemplateCompilerBase::$$forceNocache
 

$inheritance : bool
Inherited
inherited_from \Smarty_Internal_TemplateCompilerBase::$$inheritance
 

$known_modifier_type : array
Inherited
inherited_from \Smarty_Internal_TemplateCompilerBase::$$known_modifier_type
 

$lex : object
 

$lexer_class : string
 

$local_var : array
 

$merged_templates : array
Inherited
inherited_from \Smarty_Internal_TemplateCompilerBase::$$merged_templates
 

$modifier_plugins : array
Inherited
inherited_from \Smarty_Internal_TemplateCompilerBase::$$modifier_plugins
 

$parser : object
 

$parser_class : string
 

$smarty : object
 

$suppressHeader : bool
Inherited
inherited_from \Smarty_Internal_TemplateCompilerBase::$$suppressHeader
 

$suppressMergedTemplates : bool
Inherited
inherited_from \Smarty_Internal_TemplateCompilerBase::$$suppressMergedTemplates
 

$suppressNocacheProcessing : bool
Inherited
inherited_from \Smarty_Internal_TemplateCompilerBase::$$suppressNocacheProcessing
 

$suppressTemplatePropertyHeader : bool
Inherited
inherited_from \Smarty_Internal_TemplateCompilerBase::$$suppressTemplatePropertyHeader
 

$template : \Smarty_Internal_Template
Inherited
inherited_from \Smarty_Internal_TemplateCompilerBase::$$template
 

$write_compiled_code : bool
Inherited
inherited_from \Smarty_Internal_TemplateCompilerBase::$$write_compiled_code
 

$nocache_hash : mixed
Inherited
inherited_from \Smarty_Internal_TemplateCompilerBase::$$nocache_hash