Main abstract compiler class

package Smarty
subpackage Compiler

 Methods

Initialize compiler

__construct() 

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

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

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

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

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

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

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

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

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

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.

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) 

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

Parameters

$args

string

individual error message or null

$line

string

line-number

Exceptions

\SmartyCompilerException when an unexpected token is found

 Properties

 

$_tag_objects : array
 

$_tag_stack : array
 

$called_functions : array
 

$compiles_template_function : bool
 

$default_handler_plugins : array
 

$default_modifier_list : mixed
 

$forceNocache : boolean
 

$inheritance : bool
 

$known_modifier_type : array
 

$merged_templates : array
 

$modifier_plugins : array
 

$suppressHeader : bool
 

$suppressMergedTemplates : bool
 

$suppressNocacheProcessing : bool
 

$suppressTemplatePropertyHeader : bool
   

$write_compiled_code : bool
 

$nocache_hash : mixed